delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1999/11/17/18:58:55

Mailing-List: contact cygwin-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT sourceware DOT cygnus DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT sourceware DOT cygnus DOT com>
List-Archive: <http://sourceware.cygnus.com/ml/cygwin/>
List-Post: <mailto:cygwin AT sourceware DOT cygnus DOT com>
List-Help: <mailto:cygwin-help AT sourceware DOT cygnus DOT com>, <http://sourceware.cygnus.com/ml/#faqs>
Sender: cygwin-owner AT sourceware DOT cygnus DOT com
Delivered-To: mailing list cygwin AT sourceware DOT cygnus DOT com
Message-ID: <383342A9.624799A@pcbank.net>
Date: Wed, 17 Nov 1999 19:04:57 -0500
From: Eric Feliu <number6 AT pcbank DOT net>
Reply-To: number6 AT pcbank DOT net
Organization: Home PC
X-Mailer: Mozilla 4.04 [en]C-NECCK (Win95; I)
MIME-Version: 1.0
To: Torben Mikael Hansen <tmh AT mic DOT dtu DOT dk>
CC: "'cygwin'" <cygwin AT sourceware DOT cygnus DOT com>
Subject: Re: DLL that does not use cygwin ?
References: <01135E04E54DD311BAC300A0C9ED9352177BB3 AT micsrv1 DOT mic DOT dtu DOT dk>

Here is a Makefile that I got from one of Mummit Khan's help files:

#
# Makefile for Cygwin in -mno-cygwin mode. This builds a DLL that is
# independent of Cygwin DLL and only depends on MS CRTDLL runtime.
#
# If you want to use Mingw32 gcc, then use the makeit.bat file instead.
#
CC = gcc

# The root directory for mingw-extra package. You can get this package
# from the same place where you downloaded egcs-1.1.2-cygb20 from.
# You should also read the -mno-cygwin howto available from:
#  http://www.xraylith.wisc.edu/~khan/software/gnu-win32/
#
MINGW_EXTRA_ROOT = /usr/local/mingw-extra
MINGW_INCLUDES = -I$(MINGW_EXTRA_ROOT)/include
MINGW_LIBDIRS = -I$(MINGW_EXTRA_ROOT)/lib

DEBUG = -g -O2
# The -mrtd flag tells the compiler to use the PASCAL or "stdcall" calling
# convention required by VBA/Excel/etc.
CFLAGS = -mrtd $(DEBUG)
CPPFLAGS = $(MINGW_INCLUDES)

AS = as
DLLTOOL = dlltool
DLLWRAP = dllwrap

#
# Various targets to build.
#
DLL_NAME = test.dll
DLL_EXP_DEF = test.def

all: $(DLL_NAME)

#
# sources, objects, etc.
#
SRCS  = $(wildcard *.c)
OBJS := $(OBJS:.c=.o)

#
# DLL related variables. These are used when building the DLL. See later.
#

# any special flags that you need to pass to the F77 compiler when building
# the DLL. (lots of software need _DLL defined).
DLL_CFLAGS = -DBUILDING_DLL=1
# This is where you pass linker flags, such as library search path, alternate
# entry point, etc. The -s flag strips the final DLL.
DLL_LDFLAGS = $(MINGW_LIBDIRS) -s -W1,-e,_cygwin_nocygwin_init AT 12
# any extra libraries that your DLL may depend on.
DLL_LDLIBS =

#
# your sources etc that go into the DLL.
#
DLL_SRCS = test.c
DLL_OBJS = test.o

###
#
# Making DLL
#
###

#
# Note that we let dllwrap create both the DEF and IMPORT library in
# one shot. No need to run dlltool anymore.
#
DLLWRAP_FLAGS = --export-all --output-def $(DLL_EXP_DEF) \
 --target=i386-mingw32 -mno-cygwin \
 --driver-name $(CC)

$(DLL_NAME) $(DLL_EXP_DEF): $(DLL_OBJS)
 $(DLLWRAP) $(DLLWRAP_FLAGS) -o $(DLL_NAME) \
     $(DLL_OBJS) $(DLL_LDFLAGS) $(DLL_LDLIBS)

#
# dependencies.
#

#fdll.o: fdll.c

test.o: test.c


#
# default rules for building DLL objects. Note that client programs (ie.,
# the ones that *use* the DLL) have to be compiled without the DLL_CFLAGS
# flags.
#
.c.o:
 $(CC) -c $(CPPFLAGS) $(DLL_CFLAGS) $(CFLAGS) -o $@ $<

clean:
 -rm -f $(OBJS) $(DLL_OBJS) $(DLL_NAME) $(DLL_EXP_DEF)


This should allow you to build a dll that is not dependent on cygwin1.dll.

Eric

Torben Mikael Hansen wrote:

> How do I build a DLL that does not use cygwin1.dll
>
> I've tried the following but the DLL still has cygwin1.dll in its import
> table
>
> gcc -c axdrv.cpp -Wall -mno-cygwin
> ld --base-file axdrv.base --dll -o axdrv.dll -e _dll_entry AT 12 axdrv.o
> dlltool --as=as --dllname axdrv.dll --def axdrv.def --base-file axdrv.base
> --output-exp axdrv.exp
> ld --base-file axdrv.base axdrv.exp --dll -o axdrv.dll -e _dll_entry AT 12
> axdrv.o
> dlltool --as=as --dllname axdrv.dll --def axdrv.def --base-file axdrv.base
> --output-exp axdrv.exp
> ld axdrv.exp --dll -o axdrv.dll -e _dll_entry AT 12 axdrv.o
>
> Putting a -mno-cygwin anywhere else results in compile time errors.
>
> Torben
>
> ___________________________________________________
> Torben Mikael Hansen
> Research Assistant
> Nanotechnology
> Mikroelektronik Centret
> DTU Building 345e, DK-2800 Kgs. Lyngby, Denmark
>
> office: 157
> tel.:           +45 4525 5731
> lab:            +45 4525 5812
> fax:            +45 4588 7762
> email:  tmh AT mic DOT dtu DOT dk
>
>   ------------------------------------------------------------------------
> --
> Want to unsubscribe from this list?
> Send a message to cygwin-unsubscribe AT sourceware DOT cygnus DOT com




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