autoconf
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: {Spam?} Windows DLLs from Unix with minimum effort


From: Vincent Torri
Subject: Re: {Spam?} Windows DLLs from Unix with minimum effort
Date: Mon, 29 Oct 2007 19:34:10 +0100 (CET)


Hey,

On Mon, 29 Oct 2007, Jason Curl wrote:

Hello,

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);

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.

The library compiles under Windows (I haven't tested the binary yet against any 
module).

I have also another subdirectory that tests the library but I can't link to it using mingw. First it doesn't recognise that the name was simplified >(it looks for address@hidden for example instead of _my_func/my_func).

When I remove the LDFLAGS option, I instead get a different error:
/bin/sh ../../libtool --tag=CC   --mode=link gcc -mno-cygwin  -O0 -Wall   -o 
chartest.exe chartest.o test.o ../src/libmofo.la
mkdir .libs
gcc -mno-cygwin -O0 -Wall -o .libs/chartest.exe chartest.o test.o  
../src/.libs/libmofo.dll.a  -L/usr/local/lib
creating chartest.exe
./.libs/lt-chartest.c: In function `main':
./.libs/lt-chartest.c:113: warning: passing arg 2 of `execv' from incompatible 
pointer type

To create a dll, with an autotooled library, I add

-no-undefined to the

foo_la_LDFLAGS variable in the Makefile.am (I use MSYS/MinGW).

To create a def file, see for example http://www.mingw.org/docs.shtml

regards

Vincent Torri




reply via email to

[Prev in Thread] Current Thread [Next in Thread]