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

ModelicaStandardTables: Avoid C++ implementation for shared table arrays #1550

Closed
modelica-trac-importer opened this issue Jan 15, 2017 · 6 comments
Assignees
Labels
bug Critical/severe issue L: C-Sources Issue addresses Modelica/Resources/C-Sources
Milestone

Comments

@modelica-trac-importer
Copy link

Reported by beutlich on 7 Aug 2014 07:28 UTC
In #1110 a C++ implementation supporting common/shared table arrays (i.e. same table from same file referenced by multiple table objects) was committed. Actually C++ was used for two reasons

  1. Support of std::map container class
  2. Static initialization/finalization of module functions in order to call InitializeCriticalSection/DeleteCriticalSection in case of Win platforms.
    In Get rid of static buffer in ModelicaInternal #1433 we discussed that the C++ layer actually can be avoided.

Migrated-From: https://trac.modelica.org/Modelica/ticket/1550

@modelica-trac-importer modelica-trac-importer added this to the MSL3.2.2 milestone Jan 15, 2017
@modelica-trac-importer modelica-trac-importer added bug Critical/severe issue L: C-Sources Issue addresses Modelica/Resources/C-Sources labels Jan 15, 2017
@modelica-trac-importer
Copy link
Author

Comment by beutlich on 7 Aug 2014 08:06 UTC
Resolved by 01a172d.

Martin (S.): Can you please define TABLE_SHARE in OMC to test it. I already did compile tests with GCC on Linux (where Posix threads are available) and MinGW (where it falls back to the _WIN32 branch).

ToDo: Should we rename uthash and gconstructor headers to avoid name clashes? At least we should mention them in the license exclusions of MSL.

@modelica-trac-importer
Copy link
Author

Comment by sjoelund.se on 7 Aug 2014 09:06 UTC
Fixed in 8784de1. There should be no need to rename the uthash header since local headers take precedence and noone will set their include path to include Modelica/Resources/C-Sources for projects other than this one. And yes, if we list license exclusions, we should list the exceptions there.

(I am unsure why we would need the gconstructor stuff; if it is for FMU's, tools should anyway terminate the simulation which means we can reference count the external objects and free the main hash table. It does no harm as it is though.)

@modelica-trac-importer
Copy link
Author

Comment by beutlich on 7 Aug 2014 09:20 UTC
Thanks for the fix.

License info is fixed in 3cd32ed.

The gconstructor stuff is required to have a module-wide initialization call of InitializeCriticalSection and finalization call of DeleteCriticalSection on Win. See also http://stackoverflow.com/questions/1113409/attribute-constructor-equivalent-in-vc.

@modelica-trac-importer
Copy link
Author

Modified by beutlich on 7 Aug 2014 09:24 UTC

@modelica-trac-importer
Copy link
Author

Changelog modified by beutlich on 7 Aug 2014 09:24 UTC
Rewrote implementation of shared tables of Modelica Standard Tables in pure C

@modelica-trac-importer
Copy link
Author

Comment by beutlich on 7 Aug 2014 11:15 UTC
VS build remark: If ModelicaStandardTables is compiled as DLL the linker option /OPT:REF must not be set. Otherwise the module constructor (i.e. InitializeCriticalSection) is not called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Critical/severe issue L: C-Sources Issue addresses Modelica/Resources/C-Sources
Projects
None yet
Development

No branches or pull requests

2 participants