delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/1997/07/18/02:09:32

From: david AT coent DOT demon DOT co DOT uk (David Coe)
Subject: Re: Console GUI fixed? Url Correction
18 Jul 1997 02:09:32 -0700 :
Approved: cygnus DOT gnu-win32 AT cygnus DOT com
Distribution: cygnus
Message-ID: <33CF2052.3FDC.cygnus.gnu-win32@coent.demon.co.uk>
References: <199707171637 DOT MAA02512 AT ns2 DOT harborcom DOT net> <33CE5B85 DOT BFD13390 AT uci DOT edu>
Mime-Version: 1.0
X-Mailer: Mozilla 3.01Gold (WinNT; I)
Original-To: Eric Britten <ebritten AT uci DOT edu>
Original-CC: gnu-win32 AT cygnus DOT com
Original-Sender: owner-gnu-win32 AT cygnus DOT com

This is a multi-part message in MIME format.

--------------60561B033BD
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Eric Britten wrote:
> 
> Recently I posted a request about testing some software I wrote on
> Windows NT 4.0 called Console GUI.  I just want to know if it runs
> because I think I fixed the problem with the invalid images.

Sorry, it doesn't run here on NT4 + SP3 + Sergey's 16Jul cygwin.dll. Gui
claims gnugui.dll is not a valid NT image.

Attached is an adapted Makefile template from Fergus Henderson that
works fine for me building gcc dll's. Alas, equivalent g77 dll's lose
the ability to access the environment (eg getenv / putenv). Anyone else
come across this?
  
-- 
Dr David Coe			     \=\
58 Fairlawn Drive, East Grinstead     \=\   Tel +44 1342 326860
West Sussex, RH19 1NT, United Kingdom  \=\  Fax +44 1342 316019

--------------60561B033BD
Content-Type: text/plain; charset=us-ascii; name="Makefile.DLLs"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="Makefile.DLLs"

#-----------------------------------------------------------------------------#

# Makefile.DLLs (Fergus Henderson - modified by DJC)

# This Makefile contains rules are creating DLLs on Windows using gnu-win32.

#-----------------------------------------------------------------------------#

OBJS = dll_init.o dll_main.o dll_fixup.o 
LIBS=-L/usr/H-i386-cygwin32/i386-cygwin32/lib -lcygwin -luser32 -lkernel32

# This rule creates a `.def' file, which lists the symbols that are exported
# from the DLL.  We use `nm' to get a list of all the exported text (`T')
# symbols.  Note that exporting data symbols -- including uninitialized
# data (`B'), initialized data (`D'), read-only data (`R'), and common
# blocks (`C') -- does not work, so we only grep for symbols whose type
# is `T'.

%.def: $(STATIC)%.a $(OBJS)
	echo EXPORTS > $@
	nm $^ | egrep "^........ [T] _" | sed "s/[^_]*_//" >> $@

# This rule creates the export object file which contains the jump
# table array; this export object file becomes part of the DLL.
# Two passes are needed to create a relocatable DLL. 

%.exp: %.def
	ld $(LDFLAGS-$*) $(LDFLAGS) -o $*.junk			\
		--base-file $*.base				\
		--dll -e _dll_entry AT 12				\
		$(STATIC)$*.a $(OBJS)				\
		$(LDLIBS-$*) $(LDLIBS) $(LIBS)
	dlltool --as=as $(DLLTOOLFLAGS-$*) $(DLLTOOLFLAGS)	\
		--dllname $*.junk				\
		--def $<					\
		--base-file $*.base				\
		--output-exp $*.exp
ifeq "$(strip $(RELOCATABLE))" "yes"
	ld $(LDFLAGS-$*) $(LDFLAGS) -o $*.junk			\
		--dll -e _dll_entry AT 12				\
		--base-file $*.base				\
		$*.exp $(STATIC)$*.a $(OBJS)			\
		$(LDLIBS-$*) $(LDLIBS) $(LIBS)
	dlltool --as=as $(DLLTOOLFLAGS-$*) $(DLLTOOLFLAGS)	\
		--dllname $*.junk				\
		--def $<					\
		--base-file $*.base				\
		--output-exp $*.exp
endif
	rm $*.base $*.junk

# This rule creates the desired (relocatable) dynamic link library.

%.dll: %.exp
	ld $(LDFLAGS-$*) $(LDFLAGS) -o $*.dll			\
		--dll -e _dll_entry AT 12				\
		$*.exp $(STATIC)$*.a $(OBJS)			\
		$(LDLIBS-$*) $(LDLIBS) $(LIBS)

# This rule creates the import library which contains small stubs for all 
# the functions exported by the DLL which jump to them via the jump table.  
# Executables that will use the DLL must be linked against this stub library.

%.a: %.def %.dll
	dlltool --as=as	$(DLLTOOLFLAGS-$*) $(DLLTOOLFLAGS)	\
		--dllname $*.dll				\
		--def $<					\
		--output-lib $@

# This black magic piece of assembler needs to be linked in in order to
# properly terminate the list of imported DLLs.

dll_fixup.s:
	echo '.section .idata$$3' 	 > dll_fixup.s
	echo '.long 0,0,0,0, 0,0,0,0'	>> dll_fixup.s

# This obscure cludge avoids fatal diagnostics for a missing WinMain.

dll_main.c:
	echo 'int main() { return 0; }'	 > dll_main.c

# This defines the Win32 entry point for loading and unloading the DLL.

dll_init.c:
	echo '#include <windows.h> '	 		 > dll_init.c
	echo 'extern int WINAPI dll_entry (HANDLE h,DWORD reason,void *ptr); '	>> dll_init.c
	echo 'int WINAPI dll_entry (HANDLE h,DWORD reason,void *ptr) { '	>> dll_init.c
	echo '  switch (reason) { '			>> dll_init.c
	echo '    case DLL_PROCESS_ATTACH: break; '	>> dll_init.c
	echo '    case DLL_PROCESS_DETACH: break; '	>> dll_init.c
	echo '    case DLL_THREAD_ATTACH:  break; '	>> dll_init.c
	echo '    case DLL_THREAD_DETACH:  break; '	>> dll_init.c
	echo '  } return 1; } '				>> dll_init.c


--------------60561B033BD
Content-Type: text/plain; charset=us-ascii; name="Makefile"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline; filename="Makefile"

PLIB=-L/usr/lib -lXmPgplot -lcpgplot -lpgplot
XLIB=-L/usr/X11/lib -lXt -lSM -lICE -lX11

XINC=-I/usr/X11/include

STATIC=/usr/X11/lib/lib

LDLIBS=$(XLIB)

all: pgmdemo

RELOCATABLE = yes

include Makefile.DLLs

# Test Motif demo from PGPLOT

pgmdemo: pgmdemo.c Xm.a Xm.dll
	g77 -O2 $(XINC) -o $@ pgmdemo.c Xm.a $(PLIB) $(XLIB)

clean:
	rm -f *.a *.dll *.exe


--------------60561B033BD--

-
For help on using this list (especially unsubscribing), send a message to
"gnu-win32-request AT cygnus DOT com" with one line of text: "help".

- Raw text -


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