Re: [Wine]Simple use of Win32 DLL on Linux/FreeBSD?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> I want to do something simple, call a function in a DLL. Could you
> please advice how to do this? Lets say we know that in the DLL there
> is a function
> 
>   int foo(DWORD a)
> 
> and I want to call this function from the program
> 
>   int main()
>   {
>     foo(42);
>   }
> 
> What to I need to put into the directory and how do I call "winemaker"
> to make this happen?

You need a import library, usually created from a .def file which was
either supplied with the dll, or created using something like pexports.
The import library is linked directly with your code and is responsible
for invoking the DLL on behalf of your program.

You are probably going to have problems if the DLL functions are using a
different calling convention from "cdecl" (which is C linkage).  Windows
has other calling conventions like stdcall, fastcall, pascal, etc, and
none of them use the stack and registers in the same way which will
cause your program to crash either when it calls the DLL function or
when it returns.

-- 
Ryan Underwood, <nemesis@xxxxxxxxxxxx>

Attachment: signature.asc
Description: Digital signature


[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux