I am writing a NON-GUI application that I want to be cross-platform between OS X and Windows. I look at the following architecture, but I don't know if it will work on the window side:
(entry point to a specific platform) → ANSI C main loop => ANSI C model code that performs data processing / logic => (special assistants for the platform)
So, the main material that I plan to write in standard ANSI C, because A) it must be platform independent, B) I am very comfortable with C, C) It can do the job and do it well
(entry point to a specific platform) can be written in all necessary for the job, this is a small amount of code, it does not matter to me.
(Special assistants for the platform) is a sticky thing. It's like parsing XML, accessing databases, toolkit stuff for graphics, whatever. Things that aren't easy in C. Things that modern languages / frameworks provide for free. On OS X, this code will be written in Objective-C interaction with Cocoa. On Windows, I find it best to use C #
So on Windows my architecture (simplified) looks like
(C # or C?) → ANSI C → C #
Is it possible? Some thoughts / suggestions so far ..
1) Compile my C-kernel as a .dll - this is fine, but there seems to be no way to call my C # helpers if I cannot somehow get pointers to functions and pass them to my kernel, but this seems unlikely
2) Compile C.exe and C # .exe and ask them to talk through shared memory or some kind of IPC. I'm not completely against this, but it obviously introduces a lot of complexity, so it doesn't seem perfect
3) Instead of using C # C ++, it gets me good data for data management and good helper code. And I can mix it easily. And the work I'm doing can probably be easily ported to Linux. But I really don't like C ++, and I don't want this to be included in a third-party festival library. Not that it was a huge deal, but in 2010, everything you need for basic data management should be built-in. And focusing on Linux is really not a priority.
Note that no “total” alternatives are in order, as suggested in other similar SO issues I have seen; java, RealBasic, mono .. this is an extremely efficient application that executes soft real time for games / simulations, I need C and friends here to do it right (maybe you won’t, but I)