Thursday, June 02, 2011

OmniThreadLibrary Needs YOU!

That is, if you are a C++Builder programmer and want to help an open source project.

image

The problem with OmniThreadLibrary and C++Builder is very simple – I’m not using it. (The C++Builder part, obviously.) Therefore I’m not checking for compatibility with C++Builder and I cannot fix the stuff if it doesn’t work. (In C++Builder.)

And now a user reported that the OTL doesn’t compile. In C++Builder. And I don’t know how to help him. With his problems. In C++Builder.

[BCC32 Error] DSiWin32.hpp(36): E2257 , expected

[BCC32 Error] DSiWin32.hpp(346): E2040 Declaration terminated incorrectly

[BCC32 Error] OtlCommon.hpp(305): E2238 Multiple declaration for 'TOmniValueContainer::Item'

[BCC32 Error] OtlCommon.hpp(304): E2344 Earlier declaration of 'TOmniValueContainer::Item'

[BCC32 Error] OtlSync.hpp(33): E2113 Virtual function '_fastcall IOmniCriticalSection::Release()' conflicts with base class 'IUnknown'

[BCC32 Error] OtlSync.hpp(74): E2113 Virtual function '_fastcall IOmniResourceCount::Release()' conflicts with base class 'IUnknown'

Is there a nice soul out there that can tell me how to fix the problem? (Or even better, who can make sure that the OmniThreadLibrary compiles with C++ Builder.) Your fixed will be gratefully imported into the main development branch and you’ll earn an eternal fame.

3 comments:

  1. I have compiled your latest (from today's svn) and previous versions of OmniThreadLibary for C++ Builder, and I can help explain how to get it working.

    However, the fix i use, which OFTEN works with delphi components, is ugly.

    Basically it's like this:

    The C++ Builder creates header files (.hpp) automatically from the delphi .pas files.

    BUT, some of the conversions it performs to make the .hpp are not quite legal code. Or at least I have not found the C++ Builder settings that let it understand them.

    This happens with Delphi stuff that has no easy mapping to C++ Builder stuff (like the Multiple Declaration errors above that use parameters that have no C++ Builder equivelent).

    Now the good (and surprising) news is that you can almost always simply COMMENT OUT the offending lines in the .hpp file. These are almost always without exception things that you never need to be able to access from your C++ code (or can access using a different method).

    And this is in fact the case with all of the errors above.

    So you can safely tell your C++ Builder users to simply comment out all of those hpp lines that raise errors, and all will be fine.

    The dillemna is that they will have to do this every time they rebuild the OmniThread components as the hpp files will be rebuilt.

    ---

    Now there is another slight complication for C++ Builder users, which is making project files for C++ Builder. I've made a couple (old ones for C++ Builder 2007, and new ones for C++ Builder XE). I can provide those.

    And C++ Builder can also be more annoying in terms of not being able to find certain obj files unless you add paths to your program include/lib directories, so users should expect a bit of that.

    But i have infact tested the component, and recreated one of your test projects, and they run fine once all is said and done.

    Thank you again for sharing such a great library and taking the time to help your users.

    -mouser from donationcoder.com

    ReplyDelete
  2. Vladimir07:37

    There is good explanation of such problem in the JVCL library, see the BCB Compatibility Guide.html in the help directory

    ReplyDelete
  3. Thanks guys for all the info. It seems that the only reasonable way to go is to create .hpp files for official releases and to let my users fight the battle themselves inbetween :(

    ReplyDelete