delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2000/07/28/12:50:17

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
Date: Fri, 28 Jul 2000 17:49:29 +0100
From: Edmund GRIMLEY EVANS <edmundo AT rano DOT org>
To: cygwin AT sourceware DOT cygnus DOT com
Subject: Re: building a DLL
Message-ID: <20000728174929.R26092@daisy.vocalis.com>
References: <20000728172337 DOT Q26092 AT daisy DOT vocalis DOT com>
Mime-Version: 1.0
User-Agent: Mutt/1.3.5i
In-Reply-To: <20000728172337.Q26092@daisy.vocalis.com>; from edmundo@rano.org on Fri, Jul 28, 2000 at 05:23:37PM +0100

> For me, step 2 fails with "dlltool: Can't open def file: libt.def".
> 
> Was step 1 supposed to produce this file? It didn't give an error. It
> didn't even give a non-zero exit value.

Sorry, I was being stupid. It seems to work now. For the benefit of
anyone else, here's what I did.

To make a library out of t.c and link p.c with it:

$ gcc -c t.c
$ echo -e "EXPORTS\nfoo" > libt.def
$ gcc -s -Wl,--base-file,libt.base -o libt.dll t.o -Wl,-e,_libt_init AT 12
$ dlltool --base-file libt.base --def libt.def --output-exp libt.exp --dllname libt.dll
$ gcc -s -Wl,--base-file,libt.base,libt.exp -o libt.dll t.o -Wl,-e,_libt_init AT 12
$ dlltool --base-file libt.base --def libt.def --output-exp libt.exp --dllname libt.dll
$ gcc -Wl,libt.exp -o libt.dll t.o -Wl,-e,_libt_init AT 12
$ dlltool --def libt.def --dllname libt.dll --output-lib libt.a
$ gcc -c p.c
$ gcc -o p p.o libt.a

Apart from the function foo, t.c also contains the following:

__declspec(dllexport) int foo(int);

#include <windows.h>
int WINAPI libt_init(HANDLE h, DWORD reason, void *q)
{
  return 1;
}

int main()
{
  return 0;
}

Now to try building a real DLL out of source code in Prolog ...

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