-
Notifications
You must be signed in to change notification settings - Fork 13k
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
How to link dylib files? #114445
Comments
It looks like it successfully linked it, but you need to tell the dynamic linker where to find it using eg |
At first blush this looks like everything's working as intended if the library is at the project root ( I'm not at all familiar with Windows, but I believe it will pretty much always check the directory where the executable is and the current directory for libraries. This would explain things working if you're launching the app via https://learn.microsoft.com/en-us/windows/win32/dlls/dynamic-link-library-search-order By default macOS will check the current directory as well. However in this case the native library was built in a way that tells the runtime linker to only look in the paths specified by the rpath. You can verify this with There are a few things you can try: You can install the library into one of the rpath directories. Before you build your application you can change how the library identifies itself to the linker with At run-time you can include the directory where the library is in You can change whatever's being used to create the native library to not prepend |
This looks to be a question about different OS's that has been satisfactorily answered, maybe we should close the issue? |
#[link(name = "Mylib" )] works on the Windows, but Mac failed🚬
I try code in build.rs
Stack trace
How Can i link libMylib.dylib success?
The text was updated successfully, but these errors were encountered: