|
-
Nov 1st, 1999, 06:26 PM
#1
Thread Starter
New Member
Hi all,
i've created a small dll (in VC 6) with only one function :
__declspec(dllexport) void dcrp(int x) ;
and then i've declared it in a VB program :
Declare Sub dcrp Lib "crp2.dll" _
(ByVal x As Integer)
and when i call it i always get an error message " BAd Calling convention".
Please any clues ?
------------------
------------------------
Garouppa the unknown fish
------------------------
-
Nov 1st, 1999, 08:09 PM
#2
Addicted Member
You must declared x value as long in vb, because int type in c is 4 bytes and integer type in vb is 2 bytes only. And long type is 4 bytes.
------------------
smalig
[email protected]
smalig.tripod.com
-
Nov 1st, 1999, 08:44 PM
#3
Thread Starter
New Member
Thanx, in fact my problemn as i've discovered after is that when creating a new DLL via VC 6 , the exported functions are in _cdecl scheme, and to enable them to VB, the _stdcall scheme should be used.
the new problem now is that if you use the _stdcall, VC 6 no more exports your function, to avoid this, you have to add a .DEF file in your project and add the following lines :
EXPORTS
mypoorfunction
Thanx anyway !
------------------
------------------------
Garouppa the unknown fish
------------------------
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|