Project conversion

This is the forum for miscellaneous technical/programming questions.

Moderator: 2ffat

Project conversion

Postby rajesh » Thu Apr 04, 2019 12:56 am

Is there any way to convert Borland C++ builder 6 project to Embarcadero® C++Builder 10.3
rajesh
Top Poster
Top Poster
 
Posts: 47
Joined: Mon Oct 26, 2009 1:25 am

Re: Project conversion

Postby 2ffat » Thu Apr 04, 2019 5:04 am

It may depend on the libraries you used in BCB 6. I have successfully rebuild BCB 6 programs for Builder 10.3 but I had made sure that the original programming was compliant with Windows protocols. If you used any third party libraries then you will need to make sure those are either compatible or updated to 10.3. That's probably the biggest problem I've seen.

At worst, I created a new project in 10.x, then copied the functions from the original project into the new one.
James P. Cottingham

Look at me still talking
when there is science to do.
User avatar
2ffat
Forum Mod
Forum Mod
 
Posts: 444
Joined: Wed Jun 23, 2004 7:07 am
Location: South Hill, VA

Re: Project conversion

Postby rajesh » Thu Apr 04, 2019 11:43 pm

I had Simply C++ Builder 6 Form Project , Even it is not loading in the version 10,3
rajesh
Top Poster
Top Poster
 
Posts: 47
Joined: Mon Oct 26, 2009 1:25 am

Re: Project conversion

Postby smd » Fri Apr 05, 2019 2:27 am

rajesh wrote:I had Simply C++ Builder 6 Form Project , Even it is not loading in the version 10,3


I suggest copying your source files to a new directory then re-create the project file from scratch by adding those files into it and setting the various options.
-----------------------------
Scott
smd
BCBJ Guru
BCBJ Guru
 
Posts: 132
Joined: Sat Nov 29, 2014 8:02 pm
Location: Las Vegas

Re: Project conversion

Postby denville » Sat Apr 06, 2019 8:57 pm

Hi, I still use CPB6 predominantly. I also have XE7 (also obsolete !) which I occasionally use when I need its additional features (such as 64-bit compile, latest IntraWeb).

Moving from CPB 6 to XE7 I have universally found it necessary to follow the plan:
- Create a new 'Hello World' app in XE7
- One by one, add the support units to the project and check each one compiles
- Finally, replace the main form in XE7 with the old Main Form (remember to make it top of the list)
You will almost certainly come across Unicode issues which are well documented. I use a lot of traditional (8-bit) char* and you will have to find a way to get a char* from a Unicode string. Beware the t-str() - apparently it alters the underlying string! I have found the following useful and reliable:

#ifdef UNICODE
static char* C_STR( AnsiString s ) { return s.c_str(); }
static char* C_STR( String s ) { return AnsiString(s).c_str(); }
#else
#define C_STR(s) s.c_str()
#endif

then where appropriate change some_string.c_str() to C_STR(some_string) and it should work in both the Unicode platform and still in CPB6.

One other thing to remember - unfortunately it is not possible to share the same form unit between CPB6 and later versions as the later ones add properties to the form that CPB does not then understand. Bit of a pity that.

Best of luck !
denville
BCBJ Veteran
BCBJ Veteran
 
Posts: 65
Joined: Sat Mar 06, 2010 4:40 am

Re: Project conversion

Postby rlebeau » Wed Apr 17, 2019 1:38 pm

denville wrote:Beware the t-str() - apparently it alters the underlying string!


Only in C++Builder 2009 and 2010, and only if TCHAR maps to 'char'. This was for purposes of helping people migrate legacy Ansi code to Unicode. t_str() was deprecated in XE, and changed to return only wchar_t* to match c_str().

denville wrote:
Code: Select all
static char* C_STR( AnsiString s ) { return s.c_str(); }



That should be taking the AnsiString by reference:

Code: Select all
static char* C_STR( AnsiString &s ) { return s.c_str(); }


denville wrote:
Code: Select all
static char* C_STR( String s ) { return AnsiString(s).c_str(); }



That will not work at all. You are returning a pointer that is owned by a temporary AnsiString that gets destroyed when the function exits, leaving the returned pointer dangling.

Since you would be re-writing code anyway to utilize C_STR(), it would be safer to simply replace some_string.c_str() with AnsiString(some_string).c_str() and be done with it. That will work in all versions, no #ifdef's needed.

denville wrote:One other thing to remember - unfortunately it is not possible to share the same form unit between CPB6 and later versions as the later ones add properties to the form that CPB does not then understand. Bit of a pity that.


There are 3rd party tools to deal with that.
Remy Lebeau (TeamB)
Lebeau Software
User avatar
rlebeau
BCBJ Author
BCBJ Author
 
Posts: 1616
Joined: Wed Jun 01, 2005 3:21 am
Location: California, USA


Return to Technical

Who is online

Users browsing this forum: No registered users and 14 guests