0

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"))

2
  • C.call(functions_address)? Commented Aug 31, 2020 at 17:50
  • I have found a workaround. I'll post it here. Commented Aug 31, 2020 at 19:40

1 Answer 1

0

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);
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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.

Ask question

Explore related questions

See similar questions with these tags.