-1

I want make a program in c++ but I want also reuse my code to compile it in multiple operating system and architecture reducing the most possible the changes at code. So I must create a gui executable and a logic executable so that:

  • for executable logic (start from controller if compared to mvc) is sufficient set architecture set istructions (x86, x64 or arm) and operating system (ios, android, Windows, Linux, ...), then recompile my code without make syntax changes;
  • executable gui that is different at the changing to each operating system (Windows, android, ios, ...),to each architecture set (android and linux are available in arm, x86 and x64) and to each various display size under 15".

To make this I must find a way to allow at the gui executable and at the logic executable to communicate between they...how can I make this? I must use some library? there is a suite of library or library already included that are available for each combination of operating system, language and architecture set?

The goal is reuse the most possible the code of logic and make different code of gui for each combination of operating system and display size (if under 15 inches).

The IDE that I use is Visual Studio 2015 and I don't want use solutions such as .NET framework or virtual machine because I want maximize the use of efficiency of the hardware.

Hope that request is simple to understand.

n3o
  • 69
  • 1
  • 2
  • 11
  • 1
    If you have to ask this question, I doubt the most important question is efficiency of the hardware. – Dutow Jul 27 '16 at 14:55
  • Have a look at platform independent frameworks/toolkit that will assist you with this task. See https://www.qt.io/ for example. However, you question just scratches the surface of one of the most complicated topics in today's application development. There is no simple answer. – user16 Jul 27 '16 at 14:57
  • @Dutow: why I can'obtain efficiency and portability at the same time? – n3o Jul 27 '16 at 15:00
  • @n3o you **can** write efficient and portable applications. **BUT** this takes a very long time and costs usually a lot of money. – user16 Jul 27 '16 at 15:02
  • @user16 I want find a way so that gui executable and logic executable can communicate and that is valid for each operating system. – n3o Jul 27 '16 at 15:21
  • @n3o dbus might be a friend :-) https://www.freedesktop.org/wiki/Software/dbus/ – user16 Jul 27 '16 at 15:26
  • @user16 here http://stackoverflow.com/questions/14750886/transferring-data-between-executables I have read of pipes, window messages and shared memory, memory mapped files but Iwant only know if pipes and shared memory are valid for all platform... – n3o Jul 27 '16 at 15:35

2 Answers2

0

You have to use some multiplatform GUI library (Qt, wxWidgets and others). And if you really, really want to separate binary file for GUI and logic you'd have to create dynamic library (dll, so, depending on OS).

Lehu
  • 761
  • 4
  • 14
  • You *could* make the GUI and the business logic separate processes, and then you "just" have to find a portable way to do cross -process communication. – Martin Bonner supports Monica Jul 27 '16 at 15:14
  • @MartinBonner You are of course right. I just thought that separating as exec and shared lib is "a bit" simpler to do in multiplatform way :) . – Lehu Jul 27 '16 at 15:20
  • I want a way so that the communication between processes can be platform independent in programming time and valid for all, I don't want framework or virtual machine – n3o Jul 27 '16 at 15:46
  • The dynamic library must be OS dependent, but also must be graphics processor dependent, depending on the requested graphics capabilities. – Thomas Matthews Jul 27 '16 at 15:57
  • @ThomasMatthews It must and it doesn't have to. It must be compiled for particular OS, but code of functions not necessairly has to be different (if you use proper libraries). – Lehu Jul 27 '16 at 16:17
  • @Lehu: How do you handle the cases of monochrome graphics boards vs. color? How about color values per pixel? Even pixel density and aspect ratios? Some graphics cards can handle (Z-Access) layering and bitmap operations, while others don't. – Thomas Matthews Jul 27 '16 at 20:41
  • @ThomasMatthews I was thinking rather about OS portability than hardware. But it is always possible (though sometimes very tedious and complicated) to write code which checks for available features and compiles/runs proper parts. Am I mistaken? I'm always ready to learn :) . – Lehu Jul 27 '16 at 22:15
  • for the gui components I find them in other ways or implements GUi application with other IDEs, but the most important thing is find a way that is possibly integrated in C++ language and that is usable in all platform, where I can send and receive data from GUI; a thing that is similar at view class in java (with spring for example but also without it, simple implementing model - view controller pattern)...some ideas? pipes in C++ are valid in all the operating system? the shared memory I have read that can give problems changing the architecture from x86 to x64... – n3o Jul 31 '16 at 11:00
0

for the gui components I find them in other ways or implements GUi application with other IDEs, but the most important thing is find a way that is possibly integrated in C++ language and that is usable in all platform, where I can send and receive data from GUI; a thing that is similar at view class in java (with spring for example but also without it, simple implementing model - view controller pattern)...some ideas? pipes in C++ are valid in all the operating system? the shared memory I have read that can give problems changing the architecture from x86 to x64...

n3o
  • 69
  • 1
  • 2
  • 11