I am using Gnu C and Assembler together.
I have functions in a library that are assembled and linked into a DLL.
If I don't prefix the functions with underscore "_" then the compiler / linker complains, under windows.
If I do prefix them with "_" all is ok.
However, under Linux I have the problem that when the functions are prefixed with underscore "_" the
linker can't find them. If I remove the underscores then all is ok.
Does anyone know how I can leave the underscores off the names of the functions and still have windows
assembler / link ok with them?
I have a def file and i have the names without "_" in there. Should I add an "_" ?
I would like to take a look at your batch file, please.
Paul
Actually I think this page solves the problem
http://gcc.gnu.org/ml/gcc-help/2003-10/msg00333.html
I'll have to wait to try it out on cygwin/win32 though.
Rgs, James.
Heres the makefile anyways ...
LCMD=-L. -ljlc
LEXT:=.so
ASFLAGS=-gstabs
CCFLAGS:=$(ASFLAGS)
BINS=$(patsubst %.c,%,$(wildcard test*.c))
ifeq ($(OS),Windows_NT)
LCMD:=libjlc.dll
LEXT:=.dll
ASFLAGS:=$(ASFLAGS) --defsym WIN=1
BINS:=$(patsubst %.c,%.exe,$(wildcard test*.c))
endif
all: libjlc$(LEXT) $(BINS)
libjlc.so: libjlc.o
gcc -shared -o libjlc.so $<
libjlc.dll: libjlc.o
gcc -shared -o libjlc.dll libjlc.o libjlc.def -Wl,--out-implib,libjlc.a
test%:
gcc $(CCFLAGS) -o test$* $(LCMD) $(patsubst %.exe,%,$@).c
clean:
rm -f *.so *.o *.a *.dll $(BINS)
.s.o:
as $(ASFLAGS) -o $*.o $<
Hi James,
You can create import libraries containing symbols without the leading underscores, Pelle's Polink does the job. ( I sended you a PM )