delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2002/11/22/17:22:07

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/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: Fri, 22 Nov 2002 23:23:53 +0100
From: "Gerrit P. Haase" <gp AT familiehaase DOT de>
Organization: Esse keine toten Tiere
X-Priority: 3 (Normal)
Message-ID: <121531094763.20021122232353@familiehaase.de>
To: Soren A <soren_andersen AT fastmail DOT fm>
CC: cygwin AT cygwin DOT com
Subject: Re: The Black Art of DLL Creation (revisited)
In-Reply-To: <Xns92CE8DFF2E1BCsoren1Gmane@80.91.224.249>
References: <Xns92CE8DFF2E1BCsoren1Gmane AT 80 DOT 91 DOT 224 DOT 249>
MIME-Version: 1.0
X-Sender: 320081107336-0001 AT t-dialin DOT net

Hallo Soren,

> Taking apart the current build setup, we see that dlltool (through dllwrap)
> is invoked for building the shared Perl library

That is not correct.  At first a static lib is created:

/bin/ar rcu libperl.a perl.o malloc.o gv.o toke.o perly.o op.o pad.o regcomp.o dump.o util.o mg.o reentr.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o doop.o doio.o regexec.o utf8.o taint.o deb.o universal.o xsutils.o globals.o perlio.o perlapi.o numeric.o locale.o pp_pack.o pp_sort.o cygwin.o

Second, miniperl.exe is linked withthis static lib:

gcc -L/sourcecode/perl/perl59  -g -L/usr/local/lib -o miniperl miniperlmain.o opmini.o -lperl -lm -lc -lcrypt -lutil -lbinmode

Last, a shared libperl with importlib is created:

gcc -shared -o  cygperl5_9_0.dll -Wl,--out-implib=libperl.dll.a -Wl,--export-all-symbols -Wl,--enable-auto-import -Wl,--stack,8388608 \
-g -L/usr/local/lib  perl.o malloc.o gv.o toke.o perly.o op.o pad.o regcomp.o dump.o util.o mg.o reentr.o hv.o av.o run.o pp_hot.o sv.o pp.o scope.o pp_ctl.o pp_sys.o doop.o doio.o regexec.o utf8.o taint.o deb.o universal.o xsutils.o globals.o perlio.o perlapi.o numeric.o locale.o pp_pack.o pp_sort.o cygwin.o -lm -lc -lcrypt -lutil -lbinmode
Creating library file: libperl.dll.a


No dlltool or dllwrap is involved here.

[...dlltool..deffile...problems...snipped...]

Take a look in <topsourcedir>/cygwin/perlld and see:

# if some of extensions are undefined,
# no corresponding output will be done.
# most probably, you'd like to have an export library
# my $DEF_EXT = '@DEF_EXT@';
# my $EXP_EXT = '@EXP_EXT@';
my $LIB_EXT = '@LIB_EXT@';

#my $DEBUG ="perlld.out";
my $DEBUG =undef;

you may comment/uncomment the according lines to get a .def, .exp,
debug output file. This will be passed to gcc as usual which
passes it to ld:

  $command ="$CC -shared -o  $dllname";
#  $command .=" --verbose" if $verbose;

  $command .=" -Wl,--output-def=$libname$DEF_EXT" if $DEF_EXT;
  $command .=" -Wl,--output-exp=$libname$EXP_EXT" if $EXP_EXT;
  $command .=" -Wl,--out-implib=$libname.dll$LIB_EXT" if $LIB_EXT;
  $command .=" -Wl,--export-all-symbols" if $EXPORT_ALL;
  $command .=" -Wl,--enable-auto-import -Wl,--stack,8388608"; # always

There should be correct .def and .exp files then.


Gerrit
-- 
=^..^=


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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