This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: trying to build a DLL on Windows 7 gcc using 3rd party libraries
- From: Jeffrey Walton <noloader at gmail dot com>
- To: Ray Holme <rayholme at yahoo dot com>
- Cc: "gcc-help at gcc dot gnu dot org" <gcc-help at gcc dot gnu dot org>
- Date: Sat, 28 Apr 2012 12:58:35 -0400
- Subject: Re: trying to build a DLL on Windows 7 gcc using 3rd party libraries
- References: <1335561263.42227.YahooMailNeo@web162804.mail.bf1.yahoo.com>
- Reply-to: noloader at gmail dot com
On Fri, Apr 27, 2012 at 5:14 PM, Ray Holme <rayholme@yahoo.com> wrote:
> I used to do this using Borland C but no longer have that machine. I have been told that the free Microsoft compiler will work, but I am aUnix/Linux person and would prefer to use gcc on the Windows machine(s) for compilation. Compiling the user-defined-function source works fine (I have appropriate __cdecl defined for the functions just as needed in Borland's compiler without __export). However linking the DLL is not so good - the problem appears to be in using the firebird libraries. I have both the library and dll versions of both in my current working directory (for now - till I get it working, then I will try using the "-L" option ....). From what I can see in the error listed below, gcc does NOT like these .lib libraries (I also tried the .dll files, but they really were not liked by the compiler).
>
> Below is the command as entered on the PC and the error that follows.
> E:\ray\vetadmin\UDF>gcc -shared -o vetAdmin.dll udf.o -Wl,--out-implib=libvetAdmin.dll.a ^
> Â-Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--whole-archive fbclient_ms.lib ib_util_ms.lib
I'm not sure how to dial it in using GCC, but you will also want to
use /GS, /SafeSEH, and /NXCOMPAT. If the source file is high risk
(such as parsing input from untrusted sources such as the internet),
you will want to add #pragma strict_gs_check(on) to the source file.
To be clear, these are Visual Studio switches to help with hardening.
But I don't now how to instruct the GNU tools to use, for example,
/SafeSEH. And I have not been able to find GCC reading on the
switches.
Jeff
.