- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » could not find DLL (built using VS...
could not find DLL (built using VS 2015) in modelica
could not find DLL (built using VS 2015) in modelica
I have written a simple add function and made a DLL from it in Visual studio 2015. Ignore the int return, that was not necessary, I was just trying out something.
# define CLINKAGE extern "C"
# define STDCALL __stdcall
# define DLLFUNC __declspec(dllexport)
CLINKAGE
DLLFUNC int STDCALL ADD(int a, int b, int *c)
{
*c = a + b;
return *c;
}
When i access the same function in modelica as follows it compiles but throws an error while running.
function ADD
input Integer a;
input Integer b;
output Integer c;
external "C" ADD(a,b,c) annotation (
Library = "GSE",
Include = {"#include \"GSE\\GSE.h\"", "#include <stdlib.h>"},
IncludeDirectory = "modelica://CrtVehicle/Resources/Include/GSE",
LibraryDirectory = "modelica://CrtVehicle/Resources/Library/GSE");
end ADD;
The error says: Process crashed Simulation process failed. Exited with code -1073741515.
The DLL and the Lib are placed in the folder GSE in path shown above. I also tried including a win64 folder in between but it gave the same error.
The only way the simulation works if i place the DLL and lib in the working directory. I can't do that for other reasons. How can i solve this issue?
Thanks in advance.
Re: could not find DLL (built using VS 2015) in modelica
This seems like a bug but I'm not sure.
The Modelica Specification say:
"The Library name and the LibraryDirectory name in the function annotation are mapped to a linkage directive in a compiler-dependent way thereby selecting the object library suited for the respective computer platform."
It doesn't say anything about what to do when running the executable but I guess these paths should be added to the PATH?
For now, to fix this, I guess you need to put in the PATH environment variable the directory where the DLL is.
I will open a bug about this to clarify what to do.
- adrpo
- 885 Posts
Re: could not find DLL (built using VS 2015) in modelica
Thanks for your reply.
If it comes out as a bug. please let me know how i can track the issue or how can i get to know about the fixed build if there is a fix submitted for this.
I am a new user of modelica and i am not sure of the different forums used.
For now, I will add the path to the env variable "PATH".
Thanks,
Pranay Kumar
- Index
- » Usage and Applications
- » OpenModelica Usage and Applications
- » could not find DLL (built using VS...