7

I am tasked with implementing an xml editor based on Win32 as a frontend process, while the business logic will be handled via a 64bit process. In addition the communication between the two processes will be done via a message bus which can only transmit messages of the form wchar_t * . (Yes it is so bad).

Assuming you have only C++ 03 in your hands, no external library support e.g. Boost what would be the best design for this task? The use case is that the user simply edits some .xml files.

I was thinking having a function pointer table in the business logic module which handles the different messages and then returns back to "listening" to events.

Side question is there any "easy" way to serialize an object as a string?

Thanks a lot.

Edit:

Boost is now allowed. Should I go with ASIO or MPI? I guess the first one right?

FailedDev
  • 26,680
  • 9
  • 53
  • 73
  • 4
    Have you considered sending XML back and forth? `:)` – sbi Dec 08 '11 at 16:19
  • @sbi Yes, but the UI must be *stupid*. That means that is should have as little "logic" inside as possible. +1 for coded smiley :) – FailedDev Dec 08 '11 at 16:21
  • it's not too that hard writing a bunch of serialization functions operating on std::istream and std::ostream. That way they will work for strings and it's future-proof as well. What we did here was taking a good look at boost's serialization and then write our own simplified version of it. Regarding the 32/64 bit: it's not much of a problem, just pick a convention for what you're going to use to transfer sizes of objects etc and stick to it (eg number of chracters in a string). We opted for 64bit int. – stijn Dec 08 '11 at 16:22
  • 2
    @FailedDev: With my browser's fonts the non-proportional-font smileys look much better than the proportional-font ones, which is why I started to do this. Back then, however, code didn't have any background color on SO, but when they introduced that, I had already hundreds, if not thousands, of such comments. So after hesitating for a moment I decided to not to confuse my muscle memory by trying to unlearn this. (Nowadays I keep catching myself trying to do that on twitter and other places...) – sbi Dec 08 '11 at 16:32
  • If you're on win32, can you use DCOM? – bdonlan Dec 09 '11 at 16:48
  • @bdonlan DCOM is forbidden. Boost was also forbidden until I convinced them to use ASIO – FailedDev Dec 09 '11 at 17:35

2 Answers2

2

Establish a socket connection between the processes and send text messages back and forth.

For socket connections Boost.Asio is a good option, for serialization Boost.Serialization with a text archive. Although Boost.Serialization is hard to debug.

Maxim Egorushkin
  • 131,725
  • 17
  • 180
  • 271