|
From: Bill P. <bil...@sy...> - 2003-04-15 18:35:17
|
I have a small sample program written in C and both
=2Elib and .dll files which apparently work using MSVC.
They also supply the same example and shared object
libraries for Linux. I have compiled, linked and run
the program successfully under Linux. This is my first
attempt to use MinGW with the MSVC libraries.
After reading everything easily accessible on the
web about this, the current situation regarding MinGW
support for MSVC dll's still seems unclear to me.
My first attempt to link was to simply include the
=2Edll in the gcc command
gcc -o startmaple.exe startmaple.o maplec.dll
This produced a set of undefined references:
startmaple.o(.text+0x15b):startmaple.c: undefined reference to `StartMapl=
e'
startmaple.o(.text+0x1a8):startmaple.c: undefined reference to `MapleKern=
elOptio
ns'
=2E..
My 2nd attempt was to use impdef to produce a def
file from the maplec.dll file and then to use dlltool
to create a libmaplec.a file. This also produced the
same set of undefined references as above.
The output of impdef looks like this:
EXPORTS
EvalMapleProc
_EvalMapleStatement@8
_EvalhfMapleProc@16
_InitMaplePrintf@4
=2E..
Reading about these @nn names, lead me to try the -k
option on dlltool. This also had no effect.
There is also a maplec.lib file. Running nm on this
file shows:
maplec.dll:
U =A6maplec_NULL_THUNK_DATA
00000000 i .idata$2
00000000 i .idata$4
00000000 i .idata$5
00000000 i .idata$6
00041fe8 a @comp.id
00000000 I __IMPORT_DESCRIPTOR_maplec
U __NULL_IMPORT_DESCRIPTOR
maplec.dll:
00041fe8 a @comp.id
00000000 I __NULL_IMPORT_DESCRIPTOR
maplec.dll:
00000000 I =A6maplec_NULL_THUNK_DATA
00041fe8 a @comp.id
maplec.dll:
00000000 I .idata$4
00000000 I .idata$5
00000000 I .idata$6
00000000 T .text
00000000 I __imp__EvalMapleProc
U __IMPORT_DESCRIPTOR_maplec
00000000 T _EvalMapleProc
maplec.dll:
00000000 I .idata$4
00000000 I .idata$5
00000000 I .idata$6
00000000 T .text
00000000 I __imp__EvalMapleStatement@8
U __IMPORT_DESCRIPTOR_maplec
00000000 T _EvalMapleStatement@8
=2E..
So, finally based on some email in the MinGW Users
archives, I used a procedure to strip the leading _
and trailing @nn from each symbol and produced a
defs file as follows:
EXPORTS
EvalMapleProc
EvalMapleStatement
EvalhfMapleProc
InitMaplePrintf
IsMapleAssignedName
IsMapleComplexNumeric
=2E..
Then I used this stripped def file with dlltool to
produce a new libmaplec.a. With this file, gcc
actually produced an executable startmaple.exe but
when I run this program I get
The procedure entry point EvalMapleStatement could
not be located in the dynamic link library maplec.dll
OK
Apparently it does find the dll file but not the
specific entry point??
I would be very pleased if someone could point me in
the right direction for my next attempt.
Thanks.
Bill Page.
|