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

issue with methods jm_log* #15

Open
nameabs opened this issue Nov 3, 2021 · 4 comments
Open

issue with methods jm_log* #15

nameabs opened this issue Nov 3, 2021 · 4 comments

Comments

@nameabs
Copy link

nameabs commented Nov 3, 2021

Hello,

I started a project based on the cmake fmi-library, i made a few ajustment for my own project but the project works fine on eclipse with the "cmake4eclipse" module.
My need is to compile the project outside the cmake context, i'd like to integrate this code on a C++ project non cmake based(Mingw64 compiler).
After some time of ajustment and troubeshooting, i'm stuck with an issue of the type ("undefined reference to") while linking the project.
It seems that the definitions of methods jm_log_* is not in the project but rather contained in a dll (here i found the definitions in a OpenModelica dll since i use FMU from OpenModelica).

My question is : is it possible to access the source code of jm_log functions or where can i find a 64 bits library containing the definitions ? I already tried the OpenModelica dll(s) but it seems that those libs are in 32 bits (my compiler return "skipping incompatible" while trying to add them in the project as library, i'm confident it's not eclipse setting issue based).

I thank you in advance

@filip-stenstrom
Copy link
Collaborator

mingw64: FMI Library is tested and built with mingw64 (TDM-GCC). Config is given in build/config/mingw_w64. Maybe this is of some help.

jm_log_* functions are defined here: src/Util/src/JM/jm_callbacks.c (by calling macro CREATE_LOG_FUNCTIONS).

@nameabs
Copy link
Author

nameabs commented Nov 5, 2021

Hello again,

Thank you for your answear,
The config file suggest the option -m64, adding this to the compiler flag make it work.
To summarize, in order to find the definition of jm_log functions i had to add the dll libfmi_shared and add also the option -m64 to my c++ project.
Now, i have issues with jm_vector, the thing is that i can't find any dll containing the definition of those vector(fmilib contains however the jm_log definitions but not the vector ones). And so i find myself with undefined reference while linking...
Using Cmake make it work but i can't pinpoint what's making it work on cmake and not on mingw64...

Any more suggestion ?

Thank you.

@filip-stenstrom
Copy link
Collaborator

jm_vector_* function definitions etc. should be created from jm_templates_inst.c at least for the primitive types. I the template is used on a few more places, all of which will create definitions for jm_vector.

If you just compile all .c files and link them I don't know why you don't get the definitions.

@nameabs
Copy link
Author

nameabs commented Nov 10, 2021

Hello,

After investigation, my issue is located with the template in the file jm_vector.h (jm_vector_declare_template(int,double,etc..) line 359.
From what i can understand, the jm_vector_declare_template, instantiate the templates from char through jm_name_ID_map_t.

While linking, the issue start on the second call of declare template, meaning i'm able to link the char template but not the others types that follow..
the linking error is the following : undefined reference to 'jm_vector_copy_int'.

Thank you

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