simple compile and call DLL problem

Questions about Wine on Linux
Locked
chrisjonmcdonald
Newbie
Newbie
Posts: 4
Joined: Sat Oct 20, 2012 12:49 pm

simple compile and call DLL problem

Post by chrisjonmcdonald »

Hi,
Hope this is the right forum for this question.

PROBLEM: I use a 3rd party win32 program which allows you to load DLLs and execute code in your own libraries on windows. I use the program successfully under wine but wish to take advantage of unix system calls and call into libcurl.so).

I have created a simple win32 exe called simpleexe.exe to simulate my 3rd party program, compiled from C on XP using visual studio which does a LoadLibraryA, GetProcAddress to get a function and then calls that function. The function being called belongs to a simple DLL I have also written in C using Visual Studio, exported using a .def file as __stdcall. On XP, the exe file successfully loads and calls the function in the DLL. It also all executes fine using wine on linux.

Now I want to replace the windows DLL with one compiled using winegcc on fedora 18 (ultimately so I can make calls into Unix libraries from the wine-compiled DLL).

I wrote the function:

Code: Select all

#include <stdlib.h>
#include <stdio.h>
int __stdcall simpleWineFunc(int a, char* p)
{
	fprintf(stderr, "In a simple wine function a[%d], p[%s]\n", a, p);
	return a;
}
and compiled with:

Code: Select all

winegcc -mwindows -shared -o winelib.so winefunc.c
which produced winelib.dll.so

But when I execute my existing simpleexe.exe asking it to use winelib.dll.so it successfully loads the library but fails to find function simpleWineFunc.

I think this might be because it cannot find the function because it is declared __stdcall? Is this right? What compiler switches do I need to make winegcc export __stdcall functions so my windows program can find them?

thanks in advance

chris
Locked