delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2001/07/31/06:38:20

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin AT sources DOT redhat DOT com
Message-ID: <96C14D00FA99D311A8D60008C791F36409826841@devwagwodx0009.wob.vw.de>
From: "Pasch, Thomas (ACTGRO)" <extern DOT thomas DOT pasch AT volkswagen DOT de>
To: "'cygwin AT cygwin DOT com'" <cygwin AT cygwin DOT com>
Subject: Re: Symbol in DLL begin with _
Date: Tue, 31 Jul 2001 12:37:36 +0200
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)

Hm,

I've managed it now. Documentation and the FAQ is a little unclear to me
(and not up to date either). Here's a bash script to do the job (for JNI
only, 
comment out the grep stuff for the more general case.

Kind regards,

Thomas

-----------------------------------
#!/bin/bash

# mkdll.sh LIBNAME OBJECTFILES
# LIBNAME: without extensions
# OBJECTFILES: *.o (with extensions)

if test $# -lt 2; then 
  echo "usage: mkdll.sh LIBNAME OBJECTS*"
  exit -1
fi
	
# additional libs to link with: here we are doing C++ stuff
export LIBS=-lstdc++
export LIBNAME=$1
shift

# based on a tip of Dmitry Timoshkov 
# zero, remove old dll
rm $LIBNAME.a $LIBNAME.dll $LIBNAME.def $LIBNAME.tmp 2>/dev/null
# first, get a EXPORT list
dlltool --add-stdcall-alias --export-all-symbols --output-def $LIBNAME.tmp
$*
# (JNI only): second, only let the 'Java_' symbols in
echo EXPORTS >$LIBNAME.def
grep "Java_" $LIBNAME.tmp >>$LIBNAME.def
# third, create the .dll
dllwrap -o $LIBNAME.dll $* $LIBS -k --def $LIBNAME.def \
    -Wl,--kill-at,--enable-stdcall-fixup
# forth, reorganize the .a lib
dlltool --kill-at --input-def $LIBNAME.def --output-lib lib$LIBNAME.a
# fifth, echo something helpful about the dependencies of the dll
cygcheck -rv $LIBNAME.dll


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