Thread View: borland.public.cppbuilder.database.multi-tier
1 messages
1 total messages
Started by Lawerence McHugh
Tue, 02 Nov 1999 00:00
Dynamically loaded functions crash
Author: Lawerence McHugh
Date: Tue, 02 Nov 1999 00:00
Date: Tue, 02 Nov 1999 00:00
54 lines
2118 bytes
2118 bytes
I am using C++ builder 3 to interface to a database via a dynamically loaded
DLL. Can anyone explain why the program crashes if I do not allocate local
storage in the a module that is not used. for example this code crashes out
with an memory access error.
void __fastcall TForm1::Callit(TObject *Sender);
{
hLib = LoadLibrary("C:\\Program Files\\Goldmine\\gm4s32.dll");
if( hLib ){
// Get address
fnGMW_DB_Append GMW_DB_Append = (fnGMW_DB_Append)
etProcAddress( (HINSTANCE) hLib,"GMW_DB_Append");
// pArea & szBuf are public members
pArea = GMW_DB_Open( "OPMGR" );
if(pArea)
{
if( GMW_DB_Append( pArea, szBuf )!= 0) {
GMW_DB_Unlock(pArea);
}
}}}
however if I add char store[1000] in the module all works fine.
void __fastcall TForm1::Callit(TObject *Sender);
{
char store[1000]
hLib = LoadLibrary("C:\\Program Files\\Goldmine\\gm4s32.dll");
if( hLib ){
// Get address
fnGMW_DB_Append GMW_DB_Append = (fnGMW_DB_Append)
etProcAddress( (HINSTANCE) hLib,"GMW_DB_Append");
// pArea & szBuf are public members
pArea = GMW_DB_Open( "OPMGR" );
if(pArea)
{
if( GMW_DB_Append( pArea, szBuf )!= 0) {
GMW_DB_Unlock(pArea);
}
}}}
I don't want to leave the program like this as I cannot understand what is
happening. The more calls I make to functions in the DLL I need to increase
the size of store. I'm sure there is a simple explanation. possibly I'm
doing something stupid can anyone point me in the right direction?
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads