Hi Tremulous folks,
This is more of an engine question than a tremulous-specific one but it applies to Trem devs too. The basic question regards linking C++ classes alongside the quake3 source C classes, specifically compiling on linux. For full disclosure, this question was also posted over at
http://www.chatbear.com/unity2/6079/78,1198798504,2104/1065824/0#1Thanks in advance.
---------------------------------
I'm working on updating delire + pix's excellent q3apd mod (
http://www.selectparks.net/archive/q3apd.htm) by implementing a full version of OSC (Open Sound Control) into ioquake3 instead of the more limited PD-based FUDI protocol used in q3apd.
Off the bat, I'm working in Fedora 6, with the Planet CCRMA low latency kernel.
I'm trying to add support for the C++ based oscpack classes (
http://www.audiomulch.com/~rossb/code/oscpack/) in ioq3 and am just getting used to the process of linking C and C++ classes using extern "C". Before tackling the whole oscpack set of classes, I've been babystepping, trying to get everything compiled and working with just a basic "int foo(int bar)" function in a test C++ class which I'm calling from ioq3's g_missle.c.
Basically, has anyone out there successfully linked c++ classes with ioquake3? I think I've sorted out the basic linking process, and have included my test.cpp into the standard linking processes in the ioquake3 makefile. This entailed adding the test.o file to the Q3GOBJ_ variable in the makefile, as well as adding C++ compiling rules along the order of
$(B)/baseq3/osc/%.o: $(OSCDIR)/%.cpp
$(DO_CPP)
where DO_CPP calls the g++ compiler in this manner:
DO_CPP=$(CPP) $(BASE_CPPFLAGS) -o $@ -c $<
and...
BASE_CPPFLAGS = -v -Wall
I'm now able to compile fine, which gives me hope, however, in loading ioquake3 with my mod, the game is unable to load the qagamei386.so where the file was added, seemingly because my function "foo" is seen as undefined (see below)
Loading dll file qagame.
Sys_LoadDll(/user/r/rob/data/q3/dev/ccrma-kdevelop/build/release-linux-i386/ccrma/qagamei386.so)...
Sys_LoadDll(/user/r/rob/data/q3/dev/ccrma-kdevelop/build/release-linux-i386/ccrma/qagamei386.so) failed:
"Failed loading /user/r/rob/data/q3/dev/ccrma-kdevelop/build/release-linux-i386/ccrma/qagamei386.so: /user/r/rob/data/q3/dev/ccrma-kdevelop/build/release-linux-i386/ccrma/qagamei386.so: undefined symbol: foo"
If anyone has any advice or can point me to any substantial and helpful resources for this kind of madness, it would be GREATLY appreciate.
Thanks all, Happy Holidays!
rob
p.s. (my modified makefile or classes can be posted if anyone is interested)
p.p.s (I'm running ioquake in this manner: ./ioquake3.i386 +set sv_pure 0 +set fs_game ccrma +devmap fan +set vm_ui 0 +set vm_cgame 0 +set vm_game 0 )
-----
rob hamilton
Center for Computer Research in Music and Acoustics (CCRMA)
Stanford University
http://ccrma.stanford.edu/~rob