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 global variables in dylib when compiled with the cross-compiler #38

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

lausdahl
Copy link
Contributor

I tried to make an implementation fo the 2dtable which does not rely on having unique global variables. Since the implementation already uses malloc it does not seem to be a too big deal to use it for the global data table pointer array.

The issue is that which linux, windows, and mac (when compiled with clang on a mac) all seem to be able to load the global variables into an isolated space per loaded library. This is not the case for dylibs compiled with the cross-compiler. No matter what attributes or C tricks I try it always loads the library such that all globals are shared resulting in a runtime crash.

We discovered this for the linefollower after a slide change which meant that multiple FMUs had a 2dtable inside.

I tried to merge the changes into the template here. It would be good if we could change to implementation to avoid the issue. I simply have no idea on how to fix it otherwise.

The implementation relies on the fact that COE always unloads the FMUs in order. (it does not step at the same time that it calls terminate on different FMUs)

… the crosscompiler compile the dylib for mac such that it actually gets its own global memory. Windows, Linux and Mac if compiled on a mac works but not with the cross compiler.
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

Successfully merging this pull request may close these issues.

None yet

1 participant