NSModule question (and partial answer)
NSModule question (and partial answer)
- Subject: NSModule question (and partial answer)
- From: Thomas Lachand-Robert <email@hidden>
- Date: Mon, 15 Apr 2002 13:38:17 +0200
I would like to gain access to C functions in my own code through their
names. I know that it can be done with NSModule, and actually the
following example code works:
int doTest2(); // define elsewhere
#include <mach-o/dyld.h>
int doTest() {
NSSymbol symbol;
const char* nom = "_doTest2";
int (*f)();
if (!NSIsSymbolNameDefined(nom)) {
printf("undefined symbol %s", nom);
return -1;
}
symbol = NSLookupAndBindSymbol(nom);
f = NSAddressOfSymbol(symbol);
if (!f) return -2;
return f(); // the function doTest2() is called here
}
Now there are two questions for experts:
1/ Is it possible to retrieve the whole signature of the function by a
similar way? (types of arguments, etc.)
2/ I actually need to retrieve symbol in a statically linked library (GSL
precisely). But the previous code doesn't work, even when my program is
linked with GSL and direct calls to GSL functions work?
Thanks for any help or suggestion,
Thomas Lachand-Robert
********************** email@hidden
<< Et le chemin est long du projet ` la chose. >> Molihre, Tartuffe.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.