Mail Archives: cygwin/1998/01/10/22:16:38
From: | js AT servisoft DOT pt (Joao Pedro Sousa)
|
Subject: | __stdcall functions in relocatable DLLs
|
10 Jan 1998 22:16:38 -0800
: | |
Message-ID: | <3.0.5.32.19980111005557.007a7580.cygnus.gnu-win32@mail.servisoft.pt>
|
Mime-Version: | 1.0
|
To: | gnu-win32 AT cygnus DOT com
|
[I know this has been discussed before, but after 3 days of reading
everything I could find about it on the archives and not being able to
solve my problem I'm resorting to the mailing-list]
I'm running b18 on Win95 with Sergey's Coolview.
I'm trying to build a relocatable DLL containing some functions that use
the __stdcall calling convention.
To build the DLL I use the following commands on my Makefile:
LIBCYGWINPATH = /gnuwin32/b18/H-i386-cygwin32/i386-cygwin32/lib
CYGNUSLIBS = -lc -lcygwin -lkernel32 -lc
$(EXECUTABLE).dll: dll_init.o dll_fixup.o $(OBJS)
ld --base-file $(EXECUTABLE).base \
--dll \
-o $(EXECUTABLE).dll \
$(OBJS) dll_init.o dll_fixup.o \
-L$(LIBCYGWINPATH) \
$(CYGNUSLIBS) \
-e _dll_entry AT 12
dlltool -k --dllname $(EXECUTABLE).dll \
--def $(EXECUTABLE).def \
--base-file $(EXECUTABLE).base \
--output-exp $(EXECUTABLE).exp
ld --base-file $(EXECUTABLE).base \
$(EXECUTABLE).exp \
--dll \
-o $(EXECUTABLE).dll \
$(OBJS) dll_init.o dll_fixup.o \
-L$(LIBCYGWINPATH) \
$(CYGNUSLIBS) \
-e _dll_entry AT 12
dlltool -k --dllname $(EXECUTABLE).dll \
--def $(EXECUTABLE).def \
--base-file $(EXECUTABLE).base \
--output-exp $(EXECUTABLE).exp
ld $(EXECUTABLE).exp \
--dll \
-o $(EXECUTABLE).dll \
$(OBJS) dll_init.o dll_fixup.o \
-L$(LIBCYGWINPATH) \
$(CYGNUSLIBS) \
-e _dll_entry AT 12
dlltool -k --dllname $(EXECUTABLE).dll \
--def $(EXECUTABLE).def \
--output-lib $(EXECUTABLE).a
dllfix $(EXECUTABLE).dll
My dll.def file contains only the following:
EXPORTS
exported_func AT 16
Where @16 indicates the size of the parammeters on the stack for this
function.
When building a small test program for this DLL, everything compiles ok;
but on execution a dialog-box pops-up complainting that "The TESTDLL.EXE
file is linked to missing export X.DLL:exported_func."
Inspecting the resulting DLL with QuickView, the Export Table section does
show my "exported_func AT 16", with the @16 mangling but *without* a leading
underscore. Could this be the problem?
I tried adding a second line to my def file with the following:
exported_func=exported_func AT 16
With this alias (I think it is an alias...) the test program run but
crashes with a message of a possible corrupted stack. Which leads me to
suspect that the function is being called with the incorrect convention.
Any help on getting this to work would be greatly appreciated,
--
JPSousa
-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".
- Raw text -