Re: narwhal and PGDLLIMPORT - Mailing list pgsql-hackers

From Craig Ringer
Subject Re: narwhal and PGDLLIMPORT
Date
Msg-id 52FABA99.20407@2ndquadrant.com
Whole thread Raw
In response to Re: narwhal and PGDLLIMPORT  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: narwhal and PGDLLIMPORT  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: narwhal and PGDLLIMPORT  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
On 02/12/2014 07:30 AM, Tom Lane wrote:

> gcc -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels
-Wmissing-format-attribute-Wformat-security -fno-strict-aliasing -fwrapv -g -Wno-comment   -shared -o plperl.dll
plperl.oSPI.o Util.o -L../../../src/port -L../../../src/common -Wl,--allow-multiple-definition -L/mingw/lib
-Wl,--as-needed  -LC:/Perl/lib/CORE -lperl58 -L../../../src/backend -lpostgres -lpgcommon -lpgport -lintl -lxslt -lxml2
-lssleay32-leay32 -lz -lm  -lws2_32 -lshfolder -Wl,--export-all-symbols -Wl,--out-implib=libplperl.a
 
> Cannot export .idata$4: symbol not found
> Cannot export .idata$5: symbol not found
> Cannot export .idata$6: symbol not found
> Cannot export .text: symbol not found
> Cannot export perl58_NULL_THUNK_DATA: symbol not found
> Creating library file: libplperl.a
> collect2: ld returned 1 exit status
> make[3]: *** [plperl.dll] Error 1
> 
> Not very clear what's going on there; could this be a problem in
> narwhal's admittedly-ancient toolchain?

Easily.

> BTW, now that I look at this ... why are we bothering to build static
> libraries (.a files) for DLLs?  They have no possible use AFAICS.

This is actually compiling a DLL:
   -o plperl.dll

but is also emitting an import library:
   -Wl,--out-implib=libplperl.a

which is required if you wish to link to plperl.dll from any other
compilation unit (except for by dynamic linkage).

I don't see any use for that with plperl, but it might be a valid thing
to be doing for (e.g.) hstore.dll. Though you can't really link to it
from another module anyway, you have to go through the fmgr to get
access to its symbols at rutime, so we can probably just skip generation
of import libraries for contribs and PLs.

-- Craig Ringer                   http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training & Services



pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: narwhal and PGDLLIMPORT
Next
From: Tom Lane
Date:
Subject: Re: narwhal and PGDLLIMPORT