Wine can't load DLL, built with Winelib.

Peter Lemenkov petro at mail.ru
Sun Sep 25 15:41:31 CDT 2005


Hello All!

Please, look at the applied sources (Makefile, main application, spec-file 
and library module). I tried to load library, from main application (with 
LoadLibrary(...)). Both application and DLL, are built with winelib, using 
winegcc.

I found strange behaviour - then DLL loaded from current working 
directory, all things are OK, but then I tried to load DLL from 
.\Test\Dir\ (for example), LoadLibrary returns NULL.

What I'm doing wrong?

-- 
With best regards, Peter Lemenkov.
-------------- next part --------------
# TODO:
#	* Include <ntsecpkg.h> in Wine-include
#	* Include <security.h> in Wine-include
# 	* Port of dbx_3x.dll

CC =		winegcc
CPPFLAGS =	-I/usr/local/include/wine/windows \
		-I/usr/local/include/wine/msvcrt \
		-I./include
LNK_MAINLIBS =	-L/usr/local/lib/wine \
		-lstdc++ \
		-lwine \
		-lmsvcrt 

all: 
	$(CC) -c $(CFLAGS) $(CPPFLAGS) libtest.cpp -o libtest.o
	$(CC) -c $(CFLAGS) $(CPPFLAGS) dlltest.c   -o dlltest.o
	$(CC) libtest.o $(LNK_MAINLIBS) -o libtest.exe
	$(CC) -shared dlltest.spec dlltest.o $(LNK_MAINLIBS) -o dlltest.dll

clean:
	rm -f 	./libtest *.so *~ *.o


-------------- next part --------------
// libcashcode_test.cpp : Defines the entry point for the console application.NDLE
//

#include <windows.h>
#include <stdio.h>

int main(int argc, char* argv[])
{
	HINSTANCE lib = LoadLibrary (".\\TestDir\\dlltest.dll");

	if (!lib){
		printf ("ERROR! can't load Library from .\\TestDir\\\n");
		exit(0);
	}

	printf ("All OK!\n");
	FreeLibrary (lib);
	return 0;
}
-------------- next part --------------
@ cdecl   Func1()
@ stdcall Func2()
-------------- next part --------------
#include <windows.h>

BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD dwReason, LPVOID reserved)
{
	return TRUE;
}

int __declspec(dllexport) Func1()
{
    return 1;
}

int __declspec(dllexport) Func2()
{
    return 2;
}


More information about the wine-devel mailing list