Subject | building a DLL and trying to use gcc |
---|---|
Author | Ray Holme |
Post date | 2012-04-29T13:06:25Z |
Folks say to use the visual Microsoft suite, but it seems a shame that
gcc cannot be used everywhere. I build the .so files for Unix, Linux and
MAC using gcc. Gcc works and builds working binaries in Microsoft land
and according to the net sources - builds .dll files just fine. I just
cannot get at the firebird/interbase functions I need. I am trying to
use gcc, if that fails - I can try the visual suite and be sad (or find
the source for the two routines I need and just put them in my own UDF
code - UGLY).
----------------------
NO, using dll's does not work - see below. Using lib files comes closest
but the two routines that I am seeking to link to are not being found (I
know they are there, one in each .lib).
The only issue is linking (the ld stage of gcc). Security is addressed
but it not part of what I am trying to do right now.
I have compiled all of my functions with a prototype such as
EXPORT(char *) func..
Where in Li/Unix the EXPORT function is nothing so the declaration
becomes:
char * func..
and I have tried a few variants on the PC - gnu's gcc I tried:
char * __cdecl func..
and also tried (after perusing the stdlib.h file)
_CRTIMP char * __cdecl __MINGW_NOTHROW func..
(and for the record, Borland's C used to work with)
char * __export __CDECL func..
However the problem does NOT appear to be with my code declarations
(maybe later when it is a .dll - then maybe it will matter). BUT FOR
NOW, the problem is getting the functions in the two external libraries
to be found (do they need a special prefix declarative too - they are
in .h files from the provider now and that used to work with the Borland
compiler). I could put in additional externs if that would help in local
files (but then they would clash with the include files).
--- here is a try with the dll's (for the record
gcc -shared -o vetAdmin.dll udf.o fbclient.dll ib_util.dll
-Wl,--export-all-symbols -Wl,--enable-auto-import
fbclient.dll: file not recognized: File format not recognized
collect2: ld returned 1 exit status
--here is a try using the lib files
gcc -shared -o vetAdmin.dll udf.o fbclient_ms.lib ib_util_ms.lib
-Wl,--export-all-symbols -Wl,--enable-auto-import
udf.o:udf.c:(.text+0x1ce): undefined reference to `isc_decode_date@8'
udf.o:udf.c:(.text+0x205): undefined reference to `ib_util_malloc'
collect2: ld returned 1 exit status
gcc cannot be used everywhere. I build the .so files for Unix, Linux and
MAC using gcc. Gcc works and builds working binaries in Microsoft land
and according to the net sources - builds .dll files just fine. I just
cannot get at the firebird/interbase functions I need. I am trying to
use gcc, if that fails - I can try the visual suite and be sad (or find
the source for the two routines I need and just put them in my own UDF
code - UGLY).
----------------------
NO, using dll's does not work - see below. Using lib files comes closest
but the two routines that I am seeking to link to are not being found (I
know they are there, one in each .lib).
The only issue is linking (the ld stage of gcc). Security is addressed
but it not part of what I am trying to do right now.
I have compiled all of my functions with a prototype such as
EXPORT(char *) func..
Where in Li/Unix the EXPORT function is nothing so the declaration
becomes:
char * func..
and I have tried a few variants on the PC - gnu's gcc I tried:
char * __cdecl func..
and also tried (after perusing the stdlib.h file)
_CRTIMP char * __cdecl __MINGW_NOTHROW func..
(and for the record, Borland's C used to work with)
char * __export __CDECL func..
However the problem does NOT appear to be with my code declarations
(maybe later when it is a .dll - then maybe it will matter). BUT FOR
NOW, the problem is getting the functions in the two external libraries
to be found (do they need a special prefix declarative too - they are
in .h files from the provider now and that used to work with the Borland
compiler). I could put in additional externs if that would help in local
files (but then they would clash with the include files).
--- here is a try with the dll's (for the record
gcc -shared -o vetAdmin.dll udf.o fbclient.dll ib_util.dll
-Wl,--export-all-symbols -Wl,--enable-auto-import
fbclient.dll: file not recognized: File format not recognized
collect2: ld returned 1 exit status
--here is a try using the lib files
gcc -shared -o vetAdmin.dll udf.o fbclient_ms.lib ib_util_ms.lib
-Wl,--export-all-symbols -Wl,--enable-auto-import
udf.o:udf.c:(.text+0x1ce): undefined reference to `isc_decode_date@8'
udf.o:udf.c:(.text+0x205): undefined reference to `ib_util_malloc'
collect2: ld returned 1 exit status