How does open office achieve cross platform compatibility? I didn't see anything about gtk or qt on their website. Since I haven't done any cross platform programming, does qt and gtk just call the equivalent/similar os calls to run the program?
I think LibreOffice (it's not OpenOffice.org any more, and it was actually never called OpenOffice officially). As for Gtk/Qt, they use the OS (or another library which either calls the OS or yet another library) to do anything OS-specific.
LibreOffice is a fork of OpenOffice after a few major developers got a bit frustrated with Oracle's oversight of the project. OpenOffice I believe still exists.
Aren't the gui calls OS specific. What I'm asking, is how do you get an easily portable program without using gtk, qt, etc. Libre office is easily portable and I didn't see the use of a cross platform toolkit.
Could you store all the system calls your program would use inside a header file and then compile with a different header file for each OS. I don't see how this would be possible because the way to create a windows program is different than a generic c++ program.
Libre office is easily portable and I didn't see the use of a cross platform toolkit.
You can just create your own GUI toolkit, which seems to be exactly what they have done.
"Easily portable" does not mean it was easy to keep it portable.
Could you store all the system calls your program would use inside a header file and then compile with a different header file for each OS.
That's the general idea (roughly).
I don't see how this would be possible because the way to create a windows program is different than a generic c++ program.
The main functions for a windows program are WinMain and WinProc. The main functions for a generic program are just main. For Windows, don't you have to have WinMain call your program? On a different OS, you would have to have the other main functions call your program. From what I am saying, it seems like it wouldn't be a whole lot different that creating two separate native apps. I have little api experience, so feel free to correct me.
By Athar's previous post it seems that it is possible to create your own custom GUI kit. Say I made an app in gtkmm. How much faster on the system would it be if a custom GUI kit was made instead?
How much faster on the system would it be if a custom GUI kit was made instead?
Obviously, that solely depends on your own efforts. It'll be something between much slower and much faster.
From what I am saying, it seems like it wouldn't be a whole lot different that creating two separate native apps.
How is adding some five lines such as
1 2 3 4 5
#ifdef __WIN32__
int WinMain(...)
#else
int main(...)
#endif
anything like creating two separate applications?
Things like window creation and event handling are again handled by different implementations of an uniform interface.
I totally forgot about the preprocessor macros. By two separate apps, I meant I would have to create a separate set of of header libraries for each os.
I it beginning to seem clearer how this would be done, thx.