libtool
[Top][All Lists]
Advanced

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

Windows DLLs from Unix with minimum effort


From: Jason Curl
Subject: Windows DLLs from Unix with minimum effort
Date: Mon, 29 Oct 2007 19:20:05 +0100 (CET)

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

Needless to say that everything works when I compile under Linux when I use 
"./configure" without specifying anything more.

I would say at least the second instance might be something wrong with how I 
manage includes (although there doesn't appear to be anything wrong), or a bug 
in libtool, but I'm really not sure as this is the first time I've attempted 
such a project.

Thanks,
Jason.

Viel oder wenig? Schnell oder langsam? Unbegrenzt surfen + telefonieren
ohne Zeit- und Volumenbegrenzung? DAS TOP ANGEBOT FÜR ALLE NEUEINSTEIGER
Jetzt bei Arcor: günstig und schnell mit DSL - das All-Inclusive-Paket
für clevere Doppel-Sparer, nur  29,95 €  inkl. DSL- und ISDN-Grundgebühr!
http://www.arcor.de/rd/emf-dsl-2




reply via email to

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