Add accRegisterSymbolCallback API to control external symbol linkage.
Until now dlsym was used to lookup external symbols. Now you can
register your own function to be called when an undefined symbol is
used.
diff --git a/libacc/tests/main.cpp b/libacc/tests/main.cpp
index 13a30d4..5e9e816 100644
--- a/libacc/tests/main.cpp
+++ b/libacc/tests/main.cpp
@@ -34,6 +34,10 @@
extern "C"
void accDisassemble(ACCscript* script);
+ACCvoid* symbolLookup(ACCvoid* pContext, const ACCchar* name) {
+ return (ACCvoid*) dlsym(RTLD_DEFAULT, name);
+}
+
int main(int argc, char** argv) {
const char* inFile = NULL;
bool printListing;
@@ -91,6 +95,8 @@
accScriptSource(script, 1, scriptSource, NULL);
delete[] text;
+ accRegisterSymbolCallback(script, symbolLookup, NULL);
+
accCompileScript(script);
int result = accGetError(script);
MainPtr mainPointer = 0;