public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
* mingw32 DLLs, threads and exceptions HOWTO (Update)
@ 2002-01-21  0:23 Thomas Pfaff
  0 siblings, 0 replies; only message in thread
From: Thomas Pfaff @ 2002-01-21  0:23 UTC (permalink / raw)
  To: MinGW-users, pthreads-win32

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1150 bytes --]


This is an update of my HOWTO that i have posted about an year ago
(see http://www.geocrawler.com/archives/3/6013/2000/12/100/4789494 ).
After some discussion with Danny i think that he is right with his
solution to not touch libgcc.a (see
http://www.geocrawler.com/archives/3/6013/2001/4/250/5485779 ) and
create a replacement libmingthrd.a instead. I have modified his Makefile a
little to create a import library named libmingthrd.a directly so you must
not edit the specs file.

The advantages are:

1. libgcc.a remains unchanged.
2. There is only one dll left, mingwm10.dll is not needed anymore.

The instructions are simple:

Create a directory with libgcc.a, the attached Makefile and mthr.c,
mthr_init.c and crtmt.c from the mingw runtime sources. To avoid memory
leaks you should use runtime 1.2 or above.

After running make the directory will build a new libmingthrd.a and
gcc-mt-2.95.3.dll (the replacement for mingwm10.dll).
libmingthrd.a should be copied to the mingw32\lib directory (rename the
original libmingthrd.a first), the dll should be copied somewhere in your
Path (the mingw32\bin directory for example).

Regards,

Thomas

[-- Attachment #2: Type: APPLICATION/octet-stream, Size: 1308 bytes --]

CMD_PREFIX = 
# CMD_PREFIX = i386-mingw32-

DO_STRIP = 1

GCC_MT_DLL     = gcc-mt-2.95.3.dll
GCC_MT_LIB     = libmingwthrd.a
GCC_MT_DEF     = libmingwthrd.def
GCC_STATIC_LIB = libgcc.a

CC		= $(CMD_PREFIX)gcc
AR		= $(CMD_PREFIX)ar
RANLIB	= $(CMD_PREFIX)ranlib
STRIP	= $(CMD_PREFIX)strip
DLLTOOL	= $(CMD_PREFIX)dlltool
DLLWRAP	= $(CMD_PREFIX)dllwrap

RM		= rm -f

CFLAGS = -O2 -s
# CFLAGS = -O2 -s -DDEBUG

MTHR_OBJS = mthr.o mthr_init.o

CRT_OBJS = crtmt.o

LIBGCC_MT_OBJS = _eh.o exception.o frame.o new.o opdel.o opdelnt.o opnew.o opnewnt.o \
                 opvdel.o opvdelnt.o opvnew.o opvnewnt.o tinfo.o tinfo2.o

.c.o:;		 $(CC) -c -o $@ $(CFLAGS) $<

all: $(GCC_MT_DLL)

$(GCC_MT_DLL): $(GCC_MT_LIB) $(CRT_OBJS) $(MTHR_OBJS) $(LIBGCC_MT_OBJS)
		$(DLLWRAP) --dllname=$@ --def=$(GCC_MT_DEF) $(CRT_OBJS) $(MTHR_OBJS) $(LIBGCC_MT_OBJS)
ifneq ($(DO_STRIP),0)
		$(STRIP) $@
endif

$(GCC_MT_LIB): $(LIBGCC_MT_OBJS)
		$(DLLTOOL) --dllname=$(GCC_MT_DLL) --output-def=$(GCC_MT_DEF) --output-lib=$@ --export-all-symbols $(LIBGCC_MT_OBJS)
ifneq ($(DO_STRIP),0)
		$(STRIP) --strip-debug $@
endif

$(LIBGCC_MT_OBJS) : $(GCC_STATIC_LIB)
		$(AR) x $(GCC_STATIC_LIB) $(LIBGCC_MT_OBJS)

clean: buildclean
		$(RM) $(GCC_MT_LIB) $(GCC_MT_DLL)

buildclean:
		$(RM) $(GCC_MT_DEF) $(CRT_OBJS) $(MTHR_OBJS) $(LIBGCC_MT_OBJS)

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2002-01-21  8:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-21  0:23 mingw32 DLLs, threads and exceptions HOWTO (Update) Thomas Pfaff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).