linker failing

BlitzMax Forums/BlitzMax Programming/linker failing

Nigel Brown(Posted 2006) [#1]
I am getting a link error on one of my PC's that does'nt happen on ay of the others? same install of BlitzMAX same install of MinGW same eviroment variables? The output is listed bellow and there seems enough info to indicate the problem but I am stumped!

Linking:main.debug.exe
C:/Shared/firmware upload/portmidi/pm_win/.bmx/pmdll.c.debug.win32.x86.o(.text+0x24):pmdll.c: multiple definition of `DllMain@12'
C:/Program Files/BlitzMax/mod/brl.mod/appstub.mod/appstub.debug.win32.x86.a(appstub.win32.c.debug.win32.x86.o)(.text+0x1de):appstub.win32.c: first defined here
Build Error: Failed to link C:/Shared/firmware upload/main.debug.exe
Process complete


GfK(Posted 2006) [#2]
Rebuild modules?


Nigel Brown(Posted 2006) [#3]
have sync mods and re-built them still the same! The project is compiling port MIDI and sending sysex commands. As I mentioned before the two machines seem to be identical in everyway as far as BlitzMAX install goes but this error will not go away!


GfK(Posted 2006) [#4]
Whats the "C:/shared/firmware upload" thing??


Brendane(Posted 2006) [#5]
The problem is that one of the c files in portmidi (pmdll.c) defines the function DllMain() - as does BlitMax's appstub.c

Are you sure you have the same version of portmidi AND BM on all your machines? Are the other machines mod's up to date? - if so I would expect them to fail to link also.


Nigel Brown(Posted 2006) [#6]
c:/shared/firmware upload/ is the folder that contains my source and the portMIDI folder


Nigel Brown(Posted 2006) [#7]
Brendane: I have not uploaded the modules on the machine that works for a few days because of this errror that has appeared. Not being able to compile the code at all would be disasterous! Is there a way around the problem?


Brendane(Posted 2006) [#8]
Ok, well Mark recently added DllMain() into one of the windows startup files. (I hope because we might be getting DLL creastion support sometimes soon).

You can comment out the DLLMain() function in appstub.c (if you don't know how to, enclose the whole function with /* and */ ) - then rebuild modules. Your code should now link. (However, someone needs to ideally split the DLLMain out of portmidi to allow for the new BMax updates).


Brendane(Posted 2006) [#9]
that would be appstub.win32.c by the way


Brendane(Posted 2006) [#10]
Any luck with this?

I've just glanced at the portmidi source and you should be able to get away without importing "portmidi/pm_win/pmdll.c" in your module's .bmx file. That (if it works) should cure your problem regardless of BMax.