Hi,
Platform: Linux
I am trying to write a callback function. The function exists inside the
executable.
If I try to compile without using the "-rdynamic" option:
make USE_LOCAL_HEADERS=0 LDFLAGS=-L. BASE_CFLAGS=-m32 CFLAGS='-fopenmp'
Compilation is successful. However, dlsym() returns "undefined symbol:
UnLinkLinkroutingcache"
UnLinkLinkroutingcache: Is the function I am trying to callback to.
Furthermore,
If I try to compile using "-rdynamic" option:
make USE_LOCAL_HEADERS=0 LDFLAGS=-L. BASE_CFLAGS=-m32 CFLAGS='-fopenmp
-rdynamic'
The compilation is successful. However, when I try to run the Game:
./ioq3ded.ppc64 +set fs_game Mod +set sv_pure 0 +set vm_game 0 +set vm_cgame 0
+set vm_ui 0 +set dedicated 1 +exec something_117.cfg
----------------------
8146 files in pk3 files
Loading dll file qagame.
Sys_LoadDll(/r/home7/ioquake3/build/release-linux-ppc64/Mod/qagameppc.so)...
Sys_LoadDll(/r/home7/ioquake3/build/release-linux-ppc64/Mod/qagameppc.so):
succeeded ...
Sys_LoadDll(qagame) found vmMain function at 0xc4394cf0
------- Game Initialization -------
gamename: baseq3
gamedate: Dec 28 2011
zsh: segmentation fault ./ioq3ded.ppc64 +set fs_game Mod +set sv_pure 0 +set
vm_game 0 +set vm_cgame
And, it exists. Are my options incorrect?
The code is as follows:
void callUnlinkLink(void)
{
void* handle;
void (*initializer)(void);
FILE *fp;
handle = dlopen(NULL, RTLD_LAZY);
if(handle == NULL) {
// report error ...
fp = fopen("zg_ICantFindFile.txt", "a");
if( fp != NULL )
{
fprintf(fp, "%d", 1 );
fprintf(fp, "\n" );
fprintf(fp, "%s", dlerror() );
}
fclose(fp);
//exit(1);return;
} else {
initializer = dlsym(handle,"UnLinkLinkroutingcache");
if(initializer == NULL) {
// report error ...
fp = fopen("zg_ICantFindFfunction.txt", "a");
if( fp != NULL )
{
fprintf(fp, "%d", 1 );
fprintf(fp, "\n" );
fprintf(fp, "%s", dlerror() );
}
fclose(fp);
exit(1);return;
} else {
// cast initializer to its proper type and use
initializer();
}
// use the result in a call to dlsym
}
}
_______________________________________________
ioquake3 mailing list
[email protected]
http://lists.ioquake.org/listinfo.cgi/ioquake3-ioquake.org
By sending this message I agree to love ioquake3 and libsdl.