This is the mail archive of the
cygwin@sourceware.cygnus.com
mailing list for the Cygwin project.
__stdcall functions in relocatable DLLs
- To: gnu-win32 at cygnus dot com
- Subject: __stdcall functions in relocatable DLLs
- From: Joao Pedro Sousa <js at servisoft dot pt>
- Date: Sun, 11 Jan 1998 00:55:57 +0000
[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@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@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@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@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@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@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@cygnus.com" with one line of text: "help".