Simple Windows DLL does not work correctly with winelib - HELP

list at list at
Fri Jun 7 12:50:36 CDT 2002

Hello All,

I am trying to create a shared object from a DLL with winelib.
I have been unable to make things work. Therefore
I made a small example that points out the issues I am facing.

I certainly appreciate your help. This has been tested
on the last two versions of wine.
wine-20020509 and 20020605

Say I had a windows DLL defined in mytest.c as
#include <windows.h>
#include <stdio.h>
BOOL APIENTRY DllMain(HINSTANCE  hinstDLL , DWORD fdwReason, LPVOID  lpvReserved
) {
        printf("DllMain called");
        return TRUE;

void usefullFunction() {
        printf("Usefull function got called");

I put mytest.c inside a directory called mytest

I then call winemaker as
winemaker --dll --nomfc .

I edit libmytest.spec so it looks like
name    meuteste
type    win32
mode    dll
init    DllMain

I then call configure make and make install

I edit a file called callmytest.c
#include "mytest.h"
int main(void) {


After compiling, when calling ./callmytest I get output:
Usefull function got called

=>Supposed to get "DllMain got called" too

It seems winelib is not initializing correctly and calling DllMain...

It seems that the spec file format changed and so my spec file
is incorrect. [Thanks Martin Wilck for your help)

I read the libwine manual in , wine/tools/winebuild/README ,
wine-devel list etc and still cant see what else I should do.

Can someone help me get this simple example to work?

Miguel Feitosa

This is output from 
make clean all
rm -f *.spec.c lex.yy.c core *.orig *.rej \#*\# *~ *% .\#* 
meuteste.o  libmeuteste.spec.o  libmeuteste.tmp.o
gcc -c -g -O2 -fPIC  -D_REENTRANT -DWINELIB  -I.  -I/usr/local/include/wine -o
meuteste.o meuteste.c
ld -r meuteste.o   -o libmeuteste.tmp.o
strip --strip-unneeded libmeuteste.tmp.o
LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH" /usr/local/bin/winebuild
-fPIC  -L/usr/local/lib/wine -sym libmeuteste.tmp.o -o libmeuteste.spec.c -spec
gcc -c -g -O2 -fPIC  -D_REENTRANT -DWINELIB  -I.  -I/usr/local/include/wine -o
libmeuteste.spec.o libmeuteste.spec.c
gcc -shared -Wl,-rpath,/usr/local/lib -Wl,-Bsymbolic -o
meuteste.o   libmeuteste.spec.o      -lwine -lwine_unicode -lwine_uuid -lm

This mail sent through IMP:

More information about the wine-devel mailing list