-
Notifications
You must be signed in to change notification settings - Fork 51
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
use sourcefile instead of 'just' headers #67
Comments
Yeah, it's the usual issue of distributing C++ libraries. For LFortran I simply copy @wolfv, @SylvainCorlay what do you think is the best approach here? |
I have looked into it and do you want to merge both terminal_base and terminal into one file? I think it would be better to do two seperate source files with seperate headers. I would even do a seperate header and source file to provide things like widgets and such.
What do you think? |
@certik How do you would like to proceed with the header files? terminal.cpp or base.cpp platform.h <- plattform specific code to keep the other files clean. Just using a internal header files allows to make all functions inline |
I would go with your second approach. Regarding the platform dependent stuff, the way to do it is to have |
I was thinking about using the platform.h file as "Private" header -> project only. So we can simply create the smallest possible functions in the header file and include it into the source files of our project. The public headers would keep clean as well as the other source files. It would allow us to have the minimum for the platform independence inside of the platform header and keep all the logic and things that might need to be changed for new features in their source files. Example: platfrom.hpp inline void get_term_size(row, col) {
// logic with platform dependence
}
inline int get_input_raw() {
// platform dependent parts
} base.cpp: #include "platform.hpp"
void Term::get_term_size(row, col) {
get_term_size(row,col)
}
int get_input() {
// parse get_input_raw for specific terminals
} I wouldn't chose an approach to make the platform dependent stuff available directly, because those things are parts of others like the whole terminal size and interactive tty functions are part of the |
So what do you say? |
Either is fine with me. Yes, the header would be private. You can start with just a header and only include it in cpp files. If we need more, we can expand it. |
Ok, I'll make a PR in the coming days. Thanks! |
Awesome, thanks! |
Fixed in #132. |
Hello,
i want to ask, if I can split the header files of this library into header and source files. Yes, I am aware of the desciption advertising this library as a "header only library", but I see many disadvantages here.
First of all we face many bad practices:
And I want to note, that this library is quiet small and consist of two headers. I would like to move the source parts into a source file and keep the class and function definitions inside of the header file (we can even move both header together, something you were / are already planing to do, if I saw that right). As most people (hopefully) use cpp-terminal as cmake dependency, there wouldn't be anything different for them at all, if they just copy the files they would have to copy two or 3/4 files and add the source file/s to their compile target - I wouldn't call that much more complicated.
Critizism is appreceated, it's an Idea - I hope this is not against the goal of this library!
Best regards
Damon
The text was updated successfully, but these errors were encountered: