Skip to content
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

Library:: open error - code 126 #4

Closed
chip5441 opened this issue Jan 30, 2018 · 3 comments
Closed

Library:: open error - code 126 #4

chip5441 opened this issue Jan 30, 2018 · 3 comments

Comments

@chip5441
Copy link

Trying to open a DLL by full path wrapped in OsStr on windows 10. But error code 126 / The specified module could not be found, raised.

When passing path directly to open function, it works!?

Tks

@szymonwieloch
Copy link
Owner

@chip5441
Hi! Thank you for your report. I am not sure if I got you correctly. I understand that you do something like this:

Library::open(path)

In the first case you use OsStr and it works, in the second case you use normal &str and it does not work?

The only explanation that comes to my mind is a problem with encoding string that is the argument to this function. Try to debug your code by printing out your argument and a conversion of str to OsStr. Something like this:

let your_str: &OsStr = ...<whatever>
let normal_str: &str = "c:\the\full\path.dll"; //this is the path that works.
let normal_str_converted: & OsStr = normal_str.as_ref();
println!("your={:?}, normal={:?}, converted={:?}", your_str, normal_str, normal_str_converted);

If your argument and converted are equal, then there is no reason for the library to fail. In this case please paste here your simplified code and I will try to fix this. But I suspect that you simply pass an invalid argument to the Library::open() function and this is why it does not work.

Regards!

@szymonwieloch
Copy link
Owner

@chip5441 Any updates about the issue? Do you still have the problem?

@szymonwieloch
Copy link
Owner

No response for two weeks, closing because it was probably just a problem caused by providing invalid string to the library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants