Support for translating mod files to cpp using nrnivmodl#397
Closed
pramodk wants to merge 2 commits into
Closed
Conversation
nrnhines
reviewed
Jan 5, 2020
nrnhines
left a comment
Member
There was a problem hiding this comment.
Don't the modfunc.cpp and translated .cpp files need an
extern "C" {
}
more or less from beginning to end (but not around the #include as they have their own). Or is that
an old habit I have that no longer applies?
Member
Author
|
Most likely yes! I think we will see link time errors but before that I have to resolve all those compilation errors. |
Member
|
As is, this won't work in a regular Windows cmd or PowerShell window. In that context, nrnivmodl is provided by the src/mswin/bin/nrnivmodl.bat script, which would need to be modified to pass the relevant flag to mknrndll.sh. |
Member
Author
|
I will close this for now as this requires (quite) some work. |
- nrnivmodl accept extra option -cpp by which all mod files
are translated to .cpp instead of .c
- all files are then compiled with CXX and relevant compiler
flags to build special
- keep everything backward compatible i.e. if -cpp flag is not
provided then keep old behaviour
- nocmodl accepts extra comamnd line argument ext=cpp (last argument)
by which .mod file is translated to .cpp
- nrnivmodl and relevant makefiles are updated to accept -cpp flag
fixes #384
015957c to
6f59208
Compare
6 tasks
Member
|
superseded by #1597 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on discussion in #384 I was playing with nrnivmodl and relevant files to support C++ code generation. Current implementation allows to choose C++ or C output after installation which will be helpful for debugging/developing. Once we verify that all models work without any issue with C++, we can remove current logic and make out C++ only.
Idea of this PR is to :
nrnivmodlHere is summary of changes:
are translated to .cpp instead of .c (i.e.
nrnivmodl -cpp .flags to build special
provided then keep old behaviour
by which .mod file is translated to .cpp
For example,
As shown above, compilation is failing. I now remember some fixes we did in MOD2C as well with generated code to compiler with CXX. I think it won't take much efforts to fix compilation issues / generated code (e.g. mismatch with function prototypes/definitions, K&R function declarations).
fixes #384