Hi Modelica Gurus around the earth,
I am trying to linking my C code that calls external library, namely GLPK (GNU Linear Programming Kit) with my Modelica model.
The C code works just fine, I have tested it in a stand alone condition.
gcc standalonecode.c -lglpk -o standalonecode
When I plugged in the external C function with my Modelica models, I started to get this error:

Code:


/usr/bin/../lib/x86_64-linux-gnu/omc/libModelicaExternalC.a(ModelicaInternal.o): In function `ModelicaInternal_temporaryFileName':
(.text+0x571): warning: the use of `tmpnam' is dangerous, better use `mkstemp'
/usr/bin/../lib/x86_64-linux-gnu/omc/libModelicaMatIO.a(ModelicaMatIO.o): In function `Mat_VarDelete':
(.text+0x1e14): warning: the use of `mktemp' is dangerous, better use `mkstemp' or `mkdtemp'
examples.SimpleSystemOptimalDispatch_functions.o: In function `st_linprog':
examples.SimpleSystemOptimalDispatch_functions.c:(.text+0x8b1): undefined reference to `glp_create_prob'
examples.SimpleSystemOptimalDispatch_functions.c:(.text+0x8c1): undefined reference to `glp_set_obj_dir'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

I believe that it comes from the linking process. Do you guys know how to solve this linking problem? Thanks!
Cheers, Edited by: philgun - Jun-29-20 06:20:13
I saw your PM.
as adrpo said, we have to see your Modelica code that call the C function, especially the annotation, otherwise very little can be said.
Also please check the section 12.9.4 Annotations for External Libraries and Include Files of Modelica Specifications Modelica Documents .
You will find useful hints.

Hi guys,
Thanks for your reply. I do appreciate it. I managed to overcome the problem. The solution is in
https://stackoverflow.com/questions/626 … al-library
Thanks a lot!