-
Notifications
You must be signed in to change notification settings - Fork 0
/
package.mo
53 lines (42 loc) · 1.79 KB
/
package.mo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package OMCallPython
package Py
constant String PyHome = "";
constant String PyIncludePath = PyHome + "/include/";
constant String PyDll = PyHome + "/python.dll";
class PythonLibraryHandle
extends ExternalObject;
function constructor "External object constructor that loads the python dll"
input String pyLibPath = PyDll;
output PythonLibraryHandle pyHandle;
external "C" pyHandle = omc_PyLibLoad(pyLibPath) annotation (
IncludeDirectory = "modelica://OMCallPython/Resources/C-Sources",
Include = "#include \"OMCallPython.h\"");
end constructor;
function destructor "External object destructor that frees the python dll"
input PythonLibraryHandle pyHandle;
external "C" omc_PyLibFree(pyHandle) annotation (
IncludeDirectory = "modelica://OMCallPython/Resources/C-Sources",
Include = "#include \"OMCallPython.h\"");
end destructor;
end PythonLibraryHandle;
function initialize
input PythonLibraryHandle pyHandle;
external "C" omc_Py_Initialize() annotation (
IncludeDirectory = "modelica://OMCallPython/Resources/C-Sources",
Include = "#include \"OMCallPython.h\"");
end initialize;
function run
input PythonLibraryHandle pyHandle;
input String pyProgram;
external "C" omc_PyRun_SimpleString(pyProgram) annotation (
IncludeDirectory = "modelica://OMCallPython/Resources/C-Sources",
Include = "#include \"OMCallPython.h\"");
end run;
function finalize
input PythonLibraryHandle pyHandle;
external "C" omc_Py_Finalize() annotation (
IncludeDirectory = "modelica://OMCallPython/Resources/C-Sources",
Include = "#include \"OMCallPython.h\"");
end finalize;
end Py;
end OMCallPython;