From: Steven E. <ste...@ya...> - 2002-08-02 22:02:43
|
I had problems like this recently on a project I am working on where we are moving from MS_VC to mingw. From what understand the compiler will mangle the C++ and the resulting exported name will be hosed. What you need to do is run dllwrap to generate a new def with the mangled name and then alias the export name like so: (old def from MS_VC) Exports foobar.dll foo foobar bar (new def - mingw) Exports foobar.dll foo foobar=Z_foobar@4 bar=_bar@8 Once I did this the program that imported are c++ ran with no problems. There could be more going on here but I think this sums it up. Also I dont know if the new *.def can be used with MS_VC because I dont think it mangles the names internaly the same way g++ does. Anyway it worked for me but I'm still learning to program so what do I know Steven --- Rosen Georgiev <ros...@ya...> wrote: > I have two problem while linking a DLL file. > > 1. C object files can't access functions in C++ object > files > I get error like : > > gpu.o(.text+0x239):gpu.c: undefined reference to > `InitDraw' > 'InitDraw' is declered in a cpp file > > But when i rename all the *.c files to *.cpp so they > compile > with the C++ syntax this is no longer a problem. > But then i have the next problem : > > 2. All the export functions declared in the DEF file > give errors > like this one: > > gpup.exp(.edata+0x34):fake: undefined reference to > `GPUconfigure' > > And in the file i have a function > long CALLBACK GPUconfigure() { return 0; } > > # ========== The makefile looks like (if he could be > the reason) > PROJECT = gpup.dll > DEF_FILE = gpup.def > > GCC = gcc > DLLWRAP = dllwrap > CFLAGS = -Ic:\dx7sdk\include -fvtable-thunks -c > -mwindows -O3 > LDFLAGS = -Lc:\dx7sdk\lib > LIBS = -ld3dim -ld3drm -ld3dx -ld3dxd -ld3dxof -lddraw > -ldinput \ > -ldplayx -ldsetup -ldsound -ldxguid -lwinmm > > CC = $(GCC) $(CFLAGS) > > OBJS_CPP = gpu.o gpucmnds.o draw.o > > OBJS_C = > OBJS = $(OBJS_CPP) $(OBJS_C) > > $(PROJECT) : $(OBJS) > $(DLLWRAP) $(LDFLAGS) $(OBJS) --dllname $(PROJECT) > -def $(DEF_FILE) $(LIBS) > > $(OBJS_CPP) : %.o : %.cpp > $(CC) -o $@ $^ > $(OBJS_C) : %.o : %.c > $(CC) -o $@ $^ > #============ > > Can someone tell me how to get around this? > > TNX in advance > > > __________________________________________________ > Do You Yahoo!? > Yahoo! Health - Feel better, live better > http://health.yahoo.com > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > MinGW-users mailing list > Min...@li... > > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users __________________________________________________ Do You Yahoo!? Yahoo! Health - Feel better, live better http://health.yahoo.com |