Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I have an old .so file with a very complex clang parser in it and I have to call it from a go module.
... lib := C.dlopen(C.CString("./resources/bin/parser.so"), C.RTLD_LAZY) functions_address := C.dlsym(lib, C.CString("parse"))
C.call(functions_address)
I have solved this by defining a C typedef, creating a helper method and passing the "functions_address" to that helper method which calls the other function by reference
typedef char (*parse) (char *file); char bridge (parse p, char* file) { p(file); }
Add a comment
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
C.call(functions_address)?