delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/08/09/10:14:48

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: <BC36CED13C6AD311BF040008C75D2D5A021E02B2@esekint102.ki.sw.ericsson.se>
From: "Kenneth Sandberg (ERA)" <Kenneth DOT Sandberg AT era DOT ericsson DOT se>
To: "'cygwin AT sourceware DOT cygnus DOT com'" <cygwin AT sourceware DOT cygnus DOT com>
Subject: Re: Problems using a DLL created with GNU from Microsoft VC++
Date: Wed, 9 Aug 2000 07:44:03 +0200
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2651.58)
X-OriginalArrivalTime: 09 Aug 2000 05:44:06.0371 (UTC) FILETIME=[D4EA3330:01C001C4]

I have used the unix/gnu/posix functions in cygwin to compile the code. Following
script have been used to compile the code:

	#! /bin/sh
	#  Example Script to compile and link a relocatable DLL
	#    Files that make up the DLL = foo.c foo2.c init.cc fixup.c
	#        (init.cc and fixup.c are housekeeping routines needed for the DLL. The actual
	#                      library routines are in foo.c and foo2.c)
	# ***Fill in your path to libcygwin.a here (with ni trailing slash)***

	LIBPATH=/lib

	# Compile source files:
	g++ -c foo.c
	g++ -c foo2.c
	g++ -c init.cc
	g++ -c fixup.c

	# Make .def file
	echo EXPORTS > fooB.def
	nm foo.o foo2.o init.o fixup.o | grep '^........ [T] _' | sed 's/[^_]*_//' >> fooB.def

	# Link DLL
	ld --base-file fooB.base -dll -o fooB.dll foo.o foo2.o init.o fixup.o \
	 /lib/libcygwin.a -e _dll_entry AT 12
	dlltool --as=as --dllname fooB.dll --def fooB.def --base-file fooB.base --output-exp fooB.exp
	ld --base-file fooB.base fooB.exp -dll -o fooB.dll foo.o foo2.o init.o fixup.o \
	 /lib/libcygwin.a -e _dll_entry AT 12
	dlltool --as=as --dllname fooB.dll --def fooB.def --base-file fooB.base --output-exp fooB.exp
	ld fooB.exp -dll -o fooB.dll foo.o foo2.o init.o fixup.o\
	 /lib/libcygwin.a -e _dll_entry AT 12

	# Build the fooB.a lib to link to:
	dlltool --as=as --dllname fooB.dll --def fooB.def --output-lib fooB.a

	# Linking with main
	g++ main3.c -o main3.exe


 Kenneth Sandberg



--
Want to unsubscribe from this list?
Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com

- Raw text -


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