delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/07/12/11:54:43

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Date: Mon, 12 Jul 2004 19:52:49 +0400
From: Maarten Boekhold <boekhold AT emirates DOT net DOT ae>
Subject: Re: Building DLL
In-reply-to: <18b27f187b2a.187b2a18b27f@emirates.net.ae>
To: cygwin AT cygwin DOT com
Message-id: <40F2B3D1.4000603@emirates.net.ae>
MIME-version: 1.0
User-Agent: Mozilla Thunderbird 0.7.1 (Windows/20040626)
References: <18b27f187b2a DOT 187b2a18b27f AT emirates DOT net DOT ae>
X-IsSubscribed: yes

--Boundary_(ID_ytD4kRugK2fiedU4SuFTyQ)
Content-type: text/plain; charset=us-ascii; format=flowed
Content-transfer-encoding: 7BIT

Hi all,

Sorry to keep going on about this, I really want to get this working.

I've made *some* progress in how to build "plugin libraries". I have 
attached my test case to this mail in case somebody is willing to have a 
look at it. Let me describe it first.

I did some reading on the libtool documentation, and according to that, 
libtool 1.5.6 has specific support for dlopen'ed libraries (which is 
what glib/gmodule uses under the hood if I'm not mistaken). The trick is 
an extra macro to your configure.ac (AC_LIBTOOL_DLOPEN) and two 
additional flags to libtool: -module and -export-dynamic. Now, I'm not 
sure if that support is supposed to work on cygwin. But together with a 
"plugin.def" file that defines to the library that a symbol is exported 
by the executable, I can now get things to compile.

Caveat: I cannot get the 'plugin.def' file passed to the gcc command 
line when linking:

/bin/bash ./libtool --mode=link gcc  -g -O2   -o libplugin.la -rpath 
/usr/local/lib -no-undefined -module plugin.def libplugin_la-plugin.lo 
-lgobject-2.0 -lglib-2.0 -lintl -liconv
gcc -shared  .libs/libplugin_la-plugin.o  -L/usr/lib 
/usr/lib/libgobject-2.0.dll.a /usr/lib/libglib-2.0.dll.a 
/usr/lib/libintl.dll.a /usr/lib/libiconv.dll.a  -o .libs/cygplugin-0.dll 
-Wl,--image-base=0x10000000 -Wl,--out-implib,.libs/libplugin.dll.a

So instead I editted the generated 'libtool' (after running autogen.sh) 
and added it manually:

# Commands used to build and install a shared archive.
archive_cmds="\$CC -shared \$libobjs \$deplibs \$compiler_flags -o 
\$output_objdir/\$soname \${wl}--image-base=0x10000000 
\${wl}--out-implib,\$lib plugin.def"

Note the "plugin.def" at the end. Now 'make' succeeds. If anybody knows 
how I can pass the "plugin.def" to the GCC command line, I'd be very 
interested to know.

Run 'make install', and then:
	/usr/local/bin/plugintest /usr/local/lib/libplugin.la

This now gives:

$ /usr/local/bin/plugintest.exe /usr/local/lib/libplugin.la

** ERROR **:  1627507512s not a valid Win32 application.
aborting...
Aborted (core dumped)

Is this expected, and is there a way to fix this? Has anybody seen this 
before? (note: for people not familiar with gmodule, the g_module_open() 
function explicitly tests whether this is a libtool library, and if so 
retrieves the actual DLL name from the libplugin.la file).

Kind regards,

Maarten

--Boundary_(ID_ytD4kRugK2fiedU4SuFTyQ)
Content-type: application/x-gzip; name=plugintest.tar.gz
Content-transfer-encoding: base64
Content-disposition: inline; filename=plugintest.tar.gz

H4sIAGmz8kAAA+2abXPaRhDHect9iovtJoIBoSfgRetMZFAIDSBXQB+GeBRZ
OoQaPXgkkbGbyXfvnsRzsN3xBNqp7zdJEHt7uyud/rqVHWueRi4J+WRWOBiC
KAjNer0gKI2m3JQKgiApiiTCZ44kygXqIjdlpSkL4F+Xm0IBC4crac08Sa0Y
40JgWXEKF+I6Ip9mke/s+rWjwPJCPE5InByjriNx+qJ27YW1ZIaQ712nUeR7
fxFcrU6j2KafdnRzhyzbj2zLRxbcLDNiOSTODgPrE3WxHKcaeEnihW4+kXhu
+E0I8LejcIo+Ol4cWgH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
lUWYMnz5nIXxppijI/jFOZYyyypyGKWYhNHcndG584CEafIhaxCKRXLrpZxI
D7+iYqef9+RlNwADrR9zZWgpzJhYvpnrijYjJehGzvFg3OuBmxvAsWvm19WM
bkhI6/g8oT+NEGhgWhl1ymeUUPELwgtck8RxFHOr6fnXUlbacvDEtkJ6CjQ0
fVuLrfhuT/HelGZ5+XJdS3IXXEc+WCv4ZKOVOqnAVM69iehDIi693HeCWZXF
4p4hblHbIoftRwmBFJk1Juk8Dmk5mN4e+Akn+irFcEc5OK+dB7491efZ1v1j
1PHonW4MD5rj0f5PEJa//xHq2fuforD3v+NwMe4cdvELT1p/AdzZ+h+Bln75
R3fQOWiOp+hfZOt/FBa/Xzlojietv8TW/xgMtN/+k8//Bvv/H0fB0NR2Xzts
jiesv8Te/4/DSG/rh87xFP3X2fozGAwGg8FgMBgMBoPBYDAYDAaDwWAwGAwG
g8FgMBgMBoPBYOzlb1z4RwYAUAAA


--Boundary_(ID_ytD4kRugK2fiedU4SuFTyQ)
Content-Type: text/plain; charset=us-ascii

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/
--Boundary_(ID_ytD4kRugK2fiedU4SuFTyQ)--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019