[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Windows DLLs from Unix with minimum effort
From: |
Erik de Castro Lopo |
Subject: |
Re: Windows DLLs from Unix with minimum effort |
Date: |
Tue, 30 Oct 2007 07:17:11 +1100 |
Jason Curl wrote:
> Normally I write software for Posix like operating systems, but to assist
> somebody I'm writing a Windows DLL that I'd like to later use the source for
> in my Posix application without having to maintain two code bases.
>
> I'm using
> ./configure CC="gcc -mno-cygwin" LDFLAGS="-Wl,--kill-at"
> --target=i586-pc-mingw32 --disable-static
> on Cygwin to generate the Windows DLL
>
> For each function I want to export I'm using:
> #define LIBAPI __stdcall __declspec(dllexport)
> LIBAPI type_t my_func(int param1, int param2);
Personally, I find that solution ugly.
> I'd like to use uncomplicated names so it can be used in VB6.0 for
> example, which is why I use LDFLAGS. I can probably use a DEF file,
> but I'm not clear how to implement libtool/automake/autoconf so that
> the DEF file is used only for Windows, or better yet, automatically
> generated.
Have a look at my project:
http://www.mega-nerd.com/libsndfile/
which generates a .def file from a Python script which also generates
files for use with Linux and Mac OSX for use with the
"-Wl,--exported_symbols_list" linker flags.
Part of the solution is in configure.ac and part in src/Makefile.am
Hope this helps,
Erik
--
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"Microsoft's biggest weakness is that they still don't realize how
much they suck." -- Paul Graham
--
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
When aiming for the common denominator, be prepared for the
occasional division by zero.