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

Unable to load dynamic library dependencies located in FMU #125

Open
mycrocs opened this issue Jan 26, 2022 · 8 comments
Open

Unable to load dynamic library dependencies located in FMU #125

mycrocs opened this issue Jan 26, 2022 · 8 comments

Comments

@mycrocs
Copy link

mycrocs commented Jan 26, 2022

When i start to simulate my fmu, it signals an error "Unable to load dynamic library xxx.dll".
However, it works when i simulated in FMpy.
I have used dependency walker to detect the dll, it says this
image

Here are the missing dlls

image

Is it a fmu issue or a fmi4cpp issue?
My fmu is a model_exchange model generated from SCADE and is win64.

@mycrocs
Copy link
Author

mycrocs commented Jan 26, 2022

I think the fmi4cpp cannot find libegl.dll and libglesv2.dll. The two dlls and the dll loaded are in the same directory.
Does the load_library function not search that directory?

@markaren
Copy link
Member

Missing DLLs in dependency walker are red. Are libegl.dll and libglesv2.dll red?
How about FMUCompilanceChecker or other non-python based tools?

@mycrocs
Copy link
Author

mycrocs commented Jan 26, 2022

In dependency walker, they are not red. I think dependency walker will search the directory from which the dll loaded, but the load_library function won't.
I try putting the two dlls in System32 directory and it works.

@markaren
Copy link
Member

markaren commented Jan 26, 2022

I had a brief check at the FMPy code, and it changes working directory prior to loading the DLL. Thus, fmi4cpp should probably do something similar, which I'm fairly sure from memory it does not. I don't have the resources to look at it though,

@markaren markaren changed the title Unable to load dynamic library Unable to load dynamic library dependencies located in FMU Jan 26, 2022
@mycrocs
Copy link
Author

mycrocs commented Jan 26, 2022

Maybe can use LoadLibraryEx instead.

@WeilongWen
Copy link
Contributor

I have solved the problem. Actually dependent dlls path should be change before loading dynamic library. How can I contact the publisher and perhaps upload my changes?

@markaren
Copy link
Member

How can I contact the publisher and perhaps upload my changes?

You mean me? You could propose a PR if a change in FMI4cpp is suggested.

@markaren
Copy link
Member

markaren commented Sep 29, 2024

This one is probably solved by #145?

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

No branches or pull requests

3 participants