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

Add symbol declaration from other ino files #39

Open
sudar opened this issue May 19, 2013 · 4 comments
Open

Add symbol declaration from other ino files #39

sudar opened this issue May 19, 2013 · 4 comments

Comments

@sudar
Copy link
Owner

sudar commented May 19, 2013

When we have multiple ino files in a project, we can't use functions from other ino files like we do in the arduino editor.
The solution I found in order to maintain the compatibility with the standard editor is to add "extern" declarations of the symbols I need to use on top of the ino file in which I use them.

Would it be possible to make this automatic?

@sudar
Copy link
Owner Author

sudar commented May 19, 2013

Yeah that's there in my TODO list. Will add it.

I am thinking of writing a preprocessor that will add all symbols using
"extern"

Do you have a better suggestion?

On Sat, Dec 22, 2012 at 3:15 PM, Ludovic Lacoste
notifications@git.luolix.topwrote:

When we have multiple ino files in a project, we can't use functions from
other ino files like we do in the arduino editor.
The solution I found in order to maintain the compatibility with the
standard editor is to add "extern" declarations of the symbols I need to
use on top of the ino file in which I use them.

Would it be possible to make this automatic?


Reply to this email directly or view it on GitHubhttps://github.com//issues/11.

@sudar
Copy link
Owner Author

sudar commented May 19, 2013

Yeah, seems difficult to implement Makefile-style...
I do not have a better suggestion (just some thoughts about getting symbols from .o elf files but there isn't the full prototype of functions in those files...).

@matthijskooijman
Copy link
Contributor

IIUC, the Arduino IDE concatenates all files together into one big .cpp file and compiles that. I think the only way to get the same results is to actually do that, any other trickery modifying the source code will probably behave differently in some corner case or another (think about symbol ordering, preprocessor macro's, etc.).

Perhaps it makes sense to, if multiple .ino (and/or .pde?) files are present, just generate a .cpp file that #includes every .ino file and compile that?

@sudar
Copy link
Owner Author

sudar commented May 31, 2013

IIUC, the Arduino IDE concatenates all files together into one big .cpp file and compiles that. I think the only way to get the same results is to actually do that, any other trickery modifying the source code will probably behave differently in some corner case or another (think about symbol ordering, preprocessor macro's, etc.).

Yes, I agree with what you are saying.

Sometime back, I went though Arduino source code to find out what are all the pre processing that are done by Arduino and found that it all happens in this file https://github.com/arduino/Arduino/blob/master/app/src/processing/app/preproc/PdePreprocessor.java

Perhaps it makes sense to, if multiple .ino (and/or .pde?) files are present, just generate a .cpp file that #includes every .ino file and compile that?

Yes, even I think this is the best approach.

PS: I also noticed that you have already done most of it at c64f38a and 1f043bb. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants