What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » Need help: __cdecl and __stdcall

Need help: __cdecl and __stdcall
Author: Message:
Choli
Elite Member
*****

Avatar
Choli

Posts: 4714
Reputation: 42
43 / Male / Flag
Joined: Jan 2003
O.P. RE: Need help: __cdecl and __stdcall
quote:
Originally posted by raceprouk
I believe all the functions in the Win32 API use __cdecl, but VB can still use them
No, the Windows API use __stdcall, that's why VB can use them.
quote:
Originally posted by raceprouk
Typical VB API access declaration:
Private Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long

'Template':
Private Declare Function <functionname> Lib "<filename>.dll" Alias "<funcnamefromdll>" (<arglist>) As <returntype>
yes, I know :P  I have several years of experience in calling APIs from VB ;)
quote:
Originally posted by raceprouk
EDIT: Tell you what, you post the function header from your DLL, and I'll see if I can come up with a VB declaration statement to allow you to use it.
the problem is not that i don't know who to declare it in VB... anyway, if you're happier with this :P :

the VC++ DLL (traductor.dll) exports this function:
code:
int __cdecl TRADUCIR(const char *p_fichero_iso,const char *p_fichero_mac,const char *p_fichero_mec)

in VB i have this declaration:
code:
Public Declare Function TRADUCIR Lib "traductor.dll" (ByVal iso As Long, ByVal mac As Long, ByVal mec As Long) As Long

and when I try to call it from VB it says wrong call convention :refuck: (logic)

well, I've solved that doing this (however I'm still interested if vb can call __cdelc functions or how would be done if I couldn't modify the dll code) :
in VC++, add and export this function
code:
int __stdcall TRADUCIR__stdcall(const char *p_fichero_iso,const char *p_fichero_mac,const char *p_fichero_mec) {
    return TRADUCIR(p_fichero_iso,p_fichero_mac,p_fichero_mec);
}

and in VB change the declaration by this one:
code:
Public Declare Function TRADUCIR Lib "traductor.dll" Alias "TRADUCIR__stdcall" (ByVal iso As Long, ByVal mac As Long, ByVal mec As Long) As Long
:)
Messenger Plus! en espaņol:
<< http://www.msgpluslive.es/ >>
<< http://foro.msgpluslive.es/ >>
:plus4:
05-28-2004 02:15 PM
Profile PM Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Need help: __cdecl and __stdcall - by Choli on 05-26-2004 at 08:59 PM
RE: Need help: __cdecl and __stdcall - by RaceProUK on 05-28-2004 at 12:01 PM
RE: Need help: __cdecl and __stdcall - by Choli on 05-28-2004 at 02:15 PM
RE: Need help: __cdecl and __stdcall - by RaceProUK on 05-28-2004 at 03:10 PM
RE: Need help: __cdecl and __stdcall - by Mnjul on 05-28-2004 at 05:09 PM
RE: Need help: __cdecl and __stdcall - by Choli on 05-28-2004 at 11:58 PM
RE: Need help: __cdecl and __stdcall - by Jnrz7 on 05-29-2004 at 01:02 AM
RE: Need help: __cdecl and __stdcall - by RaceProUK on 05-29-2004 at 10:01 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On