-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
improve ccall symbol lookup #3342
Comments
Also, as a side note, if I try to close the first handle before trying with the second, I get a segfault:
|
I have been wondering whether to allow this, since it doesn't work in native code unless you call dlopen/dlsym explicitly. But clearly, it would be a nice feature. A related use case is when you want to determine which library to load at startup time. So there should be effectively two kinds of uses of native symbols:
The question is what the interface should be. My current idea is to use the difference between With this I believe we could get rid of add_library_mapping, and would only need dlopen/dlsym in very exotic cases. cc @StefanKarpinski @ViralBShah @vtjnash @loladiro |
Forgot one thing: the difference between a late-bound lookup that wants to be cached, versus one that actually wants to recompute the address on every call. We could use |
See #1713 |
Late bound library names would be certainly extremely useful. On mac, this would help ensure that we are picking the right library, when the symbol is present in multiple libraries. Cc: @staticfloat |
Yeap, that was my first thought as well. This would basically remove any problems of external libraries polluting our namespace with duplicate symbols, right? |
can you see if this is still a problem? should be fixed in 0.3 |
I'll take silence as confirmation that this is fixed. If not, please reopen. |
I've been trying to have two different versions of a library available, in order to check which one to use, but I can't find out how to make this work. I even tried to explicitly separate the handles to the two versions of the library, but then ccall always calls the one which was loaded first (i.e. it ignores the library name, and just uses the function name).
Here's the example code:
The last line should read
"4.45"
(and indeed it does if I don't load the other version first).I checked that the
add_library_sym
insrc/ccall.cpp
does find the correct handles and returns different pointers in the two cases.Is it possible at all to have two different functions with the same name from different libraries? Or am I doing something wrong?
The text was updated successfully, but these errors were encountered: