Thread overview
Question about DLLs & implib
Jan 29, 2007
John Kiro
Jan 30, 2007
Mike Parker
Jan 30, 2007
John Kiro
Jan 31, 2007
Carlos Santander
January 29, 2007
Hi There

I have a DLL containing functions having stdcall calling convention. In order to be able to call these functions from inside a D-language program, I tried to create an import lib for the DLL using implib.exe. But the problem is that implib.exe neglects the calling convention of the functions, i.e. doesn't take into account the name decoration, so the linker does not find them.

The only solution I see is to use the "C" calling convention instead, and use the option /s (or /system) with implib.exe:

   implib.exe /system mydll.lib mydll.dll

So is there a way to use the stdcall convention instead?

Thanks in advance
john
January 30, 2007
John Kiro wrote:
> Hi There
> 
> I have a DLL containing functions having stdcall calling convention.
> In order to be able to call these functions from inside a D-language
> program, I tried to create an import lib for the DLL using implib.exe.
> But the problem is that implib.exe neglects the calling convention of
> the functions, i.e. doesn't take into account the name decoration, so
> the linker does not find them.
> 
> The only solution I see is to use the "C" calling convention instead,
> and use the option /s (or /system) with implib.exe:
> 
>    implib.exe /system mydll.lib mydll.dll
> 
> So is there a way to use the stdcall convention instead?
> 

extern(Windows)
January 30, 2007
I'm using "extern(Windows)" already.
January 31, 2007
John Kiro escribió:
> Hi There
> 
> I have a DLL containing functions having stdcall calling convention.
> In order to be able to call these functions from inside a D-language
> program, I tried to create an import lib for the DLL using implib.exe.
> But the problem is that implib.exe neglects the calling convention of
> the functions, i.e. doesn't take into account the name decoration, so
> the linker does not find them.
> 
> The only solution I see is to use the "C" calling convention instead,
> and use the option /s (or /system) with implib.exe:
> 
>    implib.exe /system mydll.lib mydll.dll
> 
> So is there a way to use the stdcall convention instead?
> 
> Thanks in advance
> john

If you're talking about DLLs that come with Windows, I remember some of the symbols would be stdcall and others would be C (even in the same DLL), so that might be the case with you right now. Maybe you can use "lib -l" (IIRC) to check how each name is mangled?

-- 
Carlos Santander Bernal