Need help: __cdecl and __stdcall - Printable Version -Shoutbox (https://shoutbox.menthix.net) +-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58) +--- Forum: Skype & Technology (/forumdisplay.php?fid=9) +---- Forum: Tech Talk (/forumdisplay.php?fid=17) +----- Thread: Need help: __cdecl and __stdcall (/showthread.php?tid=26128) Need help: __cdecl and __stdcall by Choli on 05-26-2004 at 08:59 PM
Ok... I have a DLL written in VC++ that exports a function that uses the __cdecl calling convention and I want to call the function from a VB program. However VB uses the __stdcall calling convention so I can't use the DLL (actually I haven't tested that, but I'm sure I won't be albe to use the DLL). RE: Need help: __cdecl and __stdcall by RaceProUK on 05-28-2004 at 12:01 PM
I believe all the functions in the Win32 API use __cdecl, but VB can still use them. RE: Need help: __cdecl and __stdcall by Choli on 05-28-2004 at 02:15 PM
quote:No, the Windows API use __stdcall, that's why VB can use them. quote:yes, I know I have several years of experience in calling APIs from VB quote:the problem is not that i don't know who to declare it in VB... anyway, if you're happier with this : the VC++ DLL (traductor.dll) exports this function: code: in VB i have this declaration: code: and when I try to call it from VB it says wrong call convention (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: and in VB change the declaration by this one: code: RE: Need help: __cdecl and __stdcall by RaceProUK on 05-28-2004 at 03:10 PM I've really got to start reading up on stuff before answering questions... RE: Need help: __cdecl and __stdcall by Mnjul on 05-28-2004 at 05:09 PM
Well Choli, it seems that you haven't searched whole MSDN and Microsoft KB... (OK, I'm joking ) code: RE: Need help: __cdecl and __stdcall by Choli on 05-28-2004 at 11:58 PM
quote:lol, can you give me the link where you found that, please? quote:yes and no, dodgy things are happening here... err... I mean: When in VB (btw, VB 6, not .net) I put the CDecl keywork, VB recognices it (yay! ) but I've found this things: I call the function in the DLL and when I put the CDelc, VB says wrong calling convention and if i remove CDecl it works. That was a quick test, so I said, I'll repeat later. Now, I've exported 2 functions, one with __cdecl and the other with __stdcall. If un VB I use the CDecl I can't call the function with __stdcall but I can call it if don't use CDecl (), but I can't call the __cdecl using nor not using CDecl Also, if in VC++ I export a function without saying __cdecl nor __stdcall, I can't call it from VB either (the default setting at the VC++ proyect is __cdecl). So I'm starting to be paranoid Once the DLL is built, how can I know the calling convention of an exported function (with the dependency walker I can see the exported functions, but not their calling convention). I'm using VC++ .NET 2002, if that helps I'm sure I'm doing something wrong but it seems I missed it Well, thanks a lot for your help... After seeing how VB compiles the code with the CDecl keyword I'm sure that doing that is possible... Definetely I have to do more tests RE: Need help: __cdecl and __stdcall by Jnrz7 on 05-29-2004 at 01:02 AM
Choli, RE: Need help: __cdecl and __stdcall by RaceProUK on 05-29-2004 at 10:01 AM And in English? |