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

Ryan Underwood nemesis-lists at icequake.net
Sun Aug 1 18:44:51 CDT 2004

> 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 at icequake.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://www.winehq.org/pipermail/wine-users/attachments/20040801/fda64d8f/attachment.pgp

More information about the wine-users mailing list