views:

130

answers:

3

Can we 'easily' (in some way) compile C++Builder project into VisualStudio 2005 C++. New in C++ i'm looking for references in that matter (CBuilder vs VS). Thanks.

A: 

Well, it's all C++ in the end, so you can include your C++Builder files into a VS2005 solution and link the libraries in. VS2005 would much rather see MFC or .NET than all of the Turbo classes from C++Builder, no doubt. Importing resources may be an issue too.

I'd be interested in other answers here as well. We may need to travel down this same path on our project.

John at CashCommons
+2  A: 

If you use the VCL classes you won't be able to compile your code in Visual C++. The VCL introduces some new language structures to the C++ language, to make it compatible with delphi, __property etc. And even if you can move the VCL code to some external dynamically linked library there will still be a lot of problems calling the VCL functions. This is because the Borland __fastcall calling convention differs from most other compiler implementations of it. The Borland version passes 3 arguments to registers, while most other compilers use 2.

All in all there can occur a lot of problems from different compiler implementation, in particular if you use the VCL or the __fastcall calling convention. The thing about C++ Builder is that it is build to be compatible with Delphi and the VCL, and while the VCL is an excellent framework for RAD and GUI programs, it adds the cost of less compatibility with other compilers.

TommyA
Thanks ... and this is the case, my project include many core vcl classes.
volvox
+2  A: 

Well, not really. It's true that the "pure" C++ parts should compile, you have to very big gotchas to deal with:

First, Borland made some proprietary extensions to C++ to make it compatible with their Delphi products. I don't remember what these are offhand, but they could be a problem depending on what you're doing.

But the main problem is the VCL, the main GUI library. If you're developing in C++Builder, then 99% of the time you're using the VCL, and using it rather heavily. AFAIK, the VCL will not compile under any microsoft compiler for many reasons, including the one I already mentioned.

So basically, you're stuck porting to .NET ( or MFC or whatever if you're a masochist) if you want to get this running under VisualStudio. One bright spot here is that many 3rd party component developers have embraced .NET, so you may not have to to as much work to port the project as you think.

MadCoder