-
Notifications
You must be signed in to change notification settings - Fork 168
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
Make ModelicaIO.h usable from a C++ environment #2008
Comments
Comment by hansolsson on 13 Jun 2016 11:13 UTC Either have no define (requires a bit more) - or use a common prefix, such as the existing "MODELICA_". |
Comment by beutlich on 13 Jun 2016 13:04 UTC |
Comment by hansolsson on 13 Jun 2016 13:23 UTC
Ah, yes, we should thus rename both of them. If necessary with another ticket. |
Comment by beutlich on 13 Jun 2016 13:31 UTC |
Modified by beutlich on 15 Jun 2016 15:53 UTC |
Comment by beutlich on 23 Jun 2016 20:40 UTC It is #if !defined(MODELICA_EXPORT)
# define MODELICA_EXPORT
#endif Proposal: Should we
This way it will be consistent throughout the C Sources. |
Comment by hansolsson on 28 Jun 2016 14:37 UTC
Yes, that seems like a good general solution. I assume it would be something like: #if !defined(MODELICA_EXPORT)
#if defined(__cplusplus)
# define MODELICA_EXPORT extern "C"
#else
# define MODELICA_EXPORT
#endif I hope that works in all cases, since we have for Dymola noticed that there are a few additional cases for various variants (declaration vs. definition, function vs. data). |
Comment by beutlich on 29 Jun 2016 13:21 UTC
This would only go to the three header files ModelicaIO.h, ModelicaMatIO.h and ModelicaStandardTables.h then, as only these files may get included from a C++ module. Right? |
Comment by hansolsson on 29 Jun 2016 14:05 UTC
Yes. |
Comment by beutlich on 29 Jun 2016 16:50 UTC |
Comment by beutlich on 30 Jun 2016 06:26 UTC |
* Add headers for ModelicaExternalC sources * Use MODELICA_EXPORT consistently (in header declaration only) and set it to `extern "C"` in case of C++ * Rename EXTERN to MATIO_EXTERN in ModelicaMatIO.h
* Add headers for ModelicaExternalC sources * Use MODELICA_EXPORT consistently (in header declaration only) and set it to `extern "C"` in case of C++ * Rename EXTERN to MATIO_EXTERN in ModelicaMatIO.h
Reported by ottot on 10 Jun 2016 10:03 UTC
The functions in ModelicaIO.h should be marked as
extern "C"
when compiled with C++ compiler, see attached patch.Migrated-From: https://trac.modelica.org/Modelica/ticket/2008
The text was updated successfully, but these errors were encountered: