I'm trying to compile a program that references __dyld_func_lookup
.
Everything compiles fine, indicating include files were able to find the function reference. However, upon the final linking, I get this error:
g++ -o ../lib/macosx64/libcogmapapi.dylib -dynamiclib ./build/CogMapApi.o ./libs/cmlabs/macosx64/AIR.a ./libs/cmlabs/macosx64/CoreLibrary.a
Undefined symbols:
"__dyld_func_lookup", referenced from:
_reference in CoreLibrary.a(dlfcn_darwin.o)
_dllopen in CoreLibrary.a(dlfcn_darwin.o)
_dllopen in CoreLibrary.a(dlfcn_darwin.o)
_dllopen in CoreLibrary.a(dlfcn_darwin.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
I've tried using -undefined dynamic_lookup
in the linker开发者_高级运维 and it does link properly, but then at runtime I get the undefined symbol as I do actually reference __dyld_func_lookup
in my code. I'm guessing I need to link to some dylib or framework, but everything I tried like System and libdl.dylib did not seem to work.
Any help would be most appreciated!
Linking dylib1.0 worked for me in same situation.
精彩评论