Protocol Buffers Lite for Borland C++

309 views
Skip to first unread message

Dazza

unread,
Oct 14, 2009, 12:53:05 AM10/14/09
to Protocol Buffers
I have ported Protocol Buffers Lite to Codegear C++ 2007 (Borland C+
+). Note the *Lite*. This seems to be working fine at the moment. I
have an example project that serializes/deserializes the simple
"address book" message as per the "Protocol Buffer Basics: C++" page.

I have not ported the compiler code. I just use the protec.exe
included in the Windows binary distribution.

Anyone interested in this? I should be able to post to a public URL
soon.

Kenton Varda

unread,
Oct 14, 2009, 4:52:56 PM10/14/09
to Dazza, Protocol Buffers
Can you send a patch?  Assuming the changes are not intrusive I'd be happy to merge this back into the main distribution.  (Although I can't guarantee that it won't break again over time since we don't test on this platform.)

Dazza

unread,
Oct 14, 2009, 6:32:41 PM10/14/09
to Protocol Buffers
Great. I think merging is definitely doable. The changes are fairly
minor and mostly guarded with #if defined(__BORLANDC__)

I had to move some of the Mutex:: methods in common.cc into an earlier
namespace section as the Borland compiler complained about having the
definition in a second namespace section. This change isn't
#ifdef'd. I would expect that this change can be made to the original
without upsetting the other compilers.

I also needed to produce a config.h file specifically for the Borland
compiler just as you have in the vsprojects directory for Microsoft VC+
+ in the standard distribution.

Lastly, I have an example Borland project file that has the correct
defines etc. to build Protocol Buffers Lite into a console application
along with an example of using addressbook.proto serialised/
deserialised to a string. One odd thing is that I have to "force c++
compile" as Borland expects c++ files to be .cpp not .cc. Of course
the files could be renamed by anyone not wanting to use that compiler
option.

I will post the source and project files to a public URL later today.

Dazza

unread,
Oct 15, 2009, 5:54:38 AM10/15/09
to Protocol Buffers
It turns out that the namespace "internal" causes problems for the
Borland C++ compiler, specifically because of the internal method
declared in <ios>. This appears to be a bug in the compiler as these
names should not collide. In order to get protocol buffers lite to
compile I used the namespace "internals" rather than "internal". I
would expect that drastic a change is not something you would want to
merge into the main tree and is too intrusive to #ifdef.

Kenton Varda

unread,
Oct 15, 2009, 4:32:54 PM10/15/09
to Dazza, Protocol Buffers
Can you upload your patch to codereview.appspot.com regardless?  I'd like to see what changes are required, and other Borland users could reuse your patch.

Dazza

unread,
Oct 18, 2009, 5:25:23 PM10/18/09
to Protocol Buffers
I have published this at:

http://www.codeshed.co.nz/protocolbuffers.php

To compare with the official implementation just rename .cpp files
to .cc. The C++ Builder compiler prefers c++ source files to have
a .cpp extension.

Dazza

unread,
Oct 22, 2009, 7:29:15 AM10/22/09
to Protocol Buffers
Do you still need me to upload the zip file to
codereview.appspot.com? The link http://www.codeshed.co.nz/protocolbuffers.php
is permanent so maybe you could update the wiki so that fellow Borland/
Codegear/Embarcadero (whatever it is called these days) C++ Builder
users can discover this and give it a go?

We are successfully using this port to enable access from a java web
app to a legacy windows app that was built with C++ Builder. We are
using DCOM purely as a transport layer. Our COM interface has a
single method that accepts a Protocol Buffer containing all of our
request data and returns a Protocol Buffer with reply data. We are
using the J-Interop library to handle DCOM on the java side. The
combination of Protocol Buffers and J-Interop is working well. This
is fast both in performance and developer productivity, and is so much
easier than trying to work with COM directly.

Kenton Varda

unread,
Oct 22, 2009, 4:25:39 PM10/22/09
to Dazza, Protocol Buffers
It would be nicer to get the changes into the official release if possible, rather than have a fork which may become out-of-date.  But for that, I really need you to provide a patch, preferably against the latest SVN sources, rather than a zip file that doesn't even have matching file names.  I will need to review the changes line-by-line, and will probably suggest a number of changes -- this is where codereview.appspot.com comes in handy, as it allows me to send you comments attached to specific lines of code.

But if you don't have time for that, I suppose I could post the link.
Reply all
Reply to author
Forward
0 new messages