dbTalk Databases Forums  

HELP : Calling DLL problems

comp.databases.paradox comp.databases.paradox


Discuss HELP : Calling DLL problems in the comp.databases.paradox forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
jmalone68 (Offline)
Junior Member
 
Posts: 3
Join Date: Apr 2006

Default HELP : Calling DLL problems - 05-24-2006 , 09:43 AM






Hello All,

I can't seem to call a DLL that I've written in Visual C++ without getting a General Protection Fault.
The problem is when I try to pass parameters. Functions that don't have parameters work fine.

C++ Code:
long SameNumber(long lReturnThis)
{
return lReturnThis;
}
Paradox Code:
Uses NetworkInfo
SameNumber(lNumber CLONG) CLONG
endUses
var
lResult LongInt
endvar
lResult = SameNumber(111) ; This is where the GPF occurs
What am I missing here?
Any help would be GREATLY appreciated.
Cheers,
John

Reply With Quote
  #2  
Old   
jmalone68 (Offline)
Junior Member
 
Posts: 3
Join Date: Apr 2006

Default Solution found! - 05-24-2006 , 10:23 AM






Back again!
I found the solution to my own problem.
It was to do with the code produced by the Microsoft C++ compiler/linker.
By default Microsoft C++ compiles functions using the __cdecl parameter calling convention. The rest of the known world uses the __stdcall parameter calling convention.
As a result all the was needed was to change the function definitions in the C++ code, recompile and all was golden.

Before:
long SameNumber(long lReturnThis)

After:
long __stdcall SameNumber(long lReturnThis)
Cheers all. Have a good day!
John

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.