C++ Builder 5 to Builder XE

I've C++ Builder 5 in my machine and my project's code is in Buidler 5. Builder 5 has become obsolete now. I want to upgrade to some latest version of C++ Builder. As of now C++Builder XE is available. Please let me know whether I can compile my code in Builder XE? What are compatibilty issues between Builder 5 and Builder XE? If they are not compatible then please let me know which cd/ dvd of C++ Builder I should buy?
0
Jyotsna
11/2/2011 10:48:40 AM
embarcadero.cppbuilder.install 385 articles. 0 followers. Follow

3 Replies
3232 Views

Similar Articles

[PageSpeed] 19
Get it on Google Play
Get it on Apple App Store

<Jyotsna Manale> wrote in message news:416111@forums.embarcadero.com...

> I want to upgrade to some latest version of C++ Builder.
> As of now C++Builder XE is available.

XE2 is the latest.

> Please let me know whether I can compile my code in Builder XE?

In general, yes.  But you have to make sure any third party 
packages/components you are using are upgraded to XE/XE2 first, that your 
code is not making any assumptions about pointer/integer byte sizes, that 
any strings that interact with the VCL are Unicode-ready, etc.  There is a 
whole migration section on the Embarcadero website: 
http://www.embarcadero.com/rad-in-action/migration-upgrade-center.

-- 
Remy Lebeau (TeamB)
1
Remy
11/2/2011 5:25:30 PM
> {quote:title=Jyotsna Manale wrote:}{quote}
> I've C++ Builder 5 in my machine and my project's code is in Buidler 5. Builder 5 has become obsolete now. I want to upgrade to some latest version of C++ Builder. As of now C++Builder XE is available. Please let me know whether I can compile my code in Builder XE? What are compatibilty issues between Builder 5 and Builder XE? If they are not compatible then please let me know which cd/ dvd of C++ Builder I should buy?

I recently converted a project from C++ Builder 5.5 to C++ Builder XE. Here are the lessons I learned and tips I can share:

1) Don't let C++ Builder XE convert your Builder 5 project. Copy your files into a new folder, create a new project and add your source files to it. It's a little more effort at first but it saves you a lot of headache later on.

2) The biggest problem is the Ansi character to Unicode conversion. All VCL functions that used to accept arguments of type "char*" (for example "Application->MessageBox") now require "wchar_t*". VCL object properties that returned "AnsiString" now return "UnicodeString" (for example "Label->Caption"). If the argument is a string constant all you have to do is place the letter "L" in front of it. It is more difficult if you are passing a variable as an argument. If you are using the type "String" in your 
code it now maps to "UnicodeString" and no longer to "AnsiString". "UnicodeString.c_str()" returns "wchar_t*" and "AnsiString.c_str()" still returns "char*". Don't bother replacing all occurrences of "String" with "AnsiString" as suggested elsewhere. Instead define the following two functions:

#define STR_CONV_BUF_SIZE 12000   // the largest string you may have to convert. depends on your project

wchar_t* __fastcall UnicodeOf(const char* c)
{
  static wchar_t w[STR_CONV_BUF_SIZE];

  memset(w,0,sizeof(w));
  MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, c, strlen(c), w, STR_CONV_BUF_SIZE);
  return(w);
}

char* __fastcall AnsiOf(wchar_t* w)
{
  static char c[STR_CONV_BUF_SIZE];

  memset(c, 0, sizeof(c));
  WideCharToMultiByte(CP_ACP, WC_NO_BEST_FIT_CHARS, w, wcslen(w), c, STR_CONV_BUF_SIZE, NULL, NULL);
  return(c);
}

and use them whereever one type is returned and the other type is required and vice versa. Careful: what makes these functions convenient to use, i.e. the static buffer, can also cause undesired behavior. Make sure "AnsiOf/UnicodeOf" is not called as an argument of a function that may itself call "AnsiOf/UnicodeOf", or that "AnsiOf/UnicodeOf" is not used for two or more arguments of the same function. 

3) Compile your project and resolve type errors by inserting calls to "AnsiOf" or "UnicodeOf" as applicable. Continue until your project compiles without errors.

4) Search for all occurrences of "sprintf", "fwrite" etc. These functions accept any variable type for some of their arguments so the compiler may not complain. Manually check whether a call to AnsiOf needs to be inserted.

5) Optimize: Eliminate some redundant use of "AnsiOf" and "UnicodeOf". For example "fopen(AnsiOf(..." can easily be replaced by "_wfopen(..." Also "fnsplit(AnsiOf(..." can relatively easily be replaced by "_wfnsplit(..." You will have to define the other arguments as "wchar_t" as well, which doesn't cause too much of a ripple effect. Furthermore "sscanf(UnicodeOf(..." can be replaced by "swscanf(..." Consider converting some of your variables from "char" to "wchar_t" wherever it makes the most sense. If y
ou used string functions such as "strcpy" etc. all you have to do is replace "str" with "wcs" in most cases. If you used "strncpy(s1, s2, sizeof(s1)-1)" as a safe version of strcpy, replace it with "wcsncpy(s1, s2, sizeof(s1)/2-1)" because the size of an array of "wchar_t" is twice the characters it can hold. 

6) Be prepared that some VCL components such as TColorGrid may not longer be available and you will have to find a workaround. 

7) The compiler wil tell you that some functions or object properties have been deprecated. You will have to work around them as well.

Once I got a handle on it didn't take longer than a day to convert a project with about 60,000 lines of code. Hope this helps.
1
Anton
11/23/2011 10:11:03 PM
Anton wrote:

> Don't bother replacing all occurrences of "String" with "AnsiString"
> as suggested elsewhere. Instead define the following two functions:

In addition to the caveats you mentioned, they are also not thread-safe.

> and use them whereever one type is returned and the other type is
> required and vice versa.

Or, you could just let the RTL handle conversions for you.  You can assign 
an AnsiString to a UnicodeString and vice versa, and the RTL will convert 
as needed.

> 4) Search for all occurrences of "sprintf", "fwrite" etc. These
> functions accept any variable type for some of their arguments so the
> compiler may not complain. Manually check whether a call to AnsiOf
> needs to be inserted.

Or update the format specifiers to use "%S" instead of "%s" as needed.

--
Remy Lebeau (TeamB)
1
Remy
11/23/2011 11:52:06 PM
Reply:

Similar Artilces:

Going from C++ Builder XE Achitect Trial to C++ Builder Professional XE
What are the correct steps that I need to perform to go from a trial of C++ Builder XE Architect Trial to a purchased copy of C++ Builder Professional XE? I want to make sure that no traces are left from the installation of the trial version. Thanks I phoned support and here is the reply: Run the 'Modify, Repair, Uninstall' link in the Embarcadero start menu. Then choose 'Upgrade' and follow instructions. ...

Convert to C++ Builder XE from C++ Builder 6 and 2007
Any information regarding the roadblocks of converting the code build in C++ Builder 6,2007 to C++ Builder XE? On 6/20/2012 8:20 AM, Girish Duddu wrote: > Any information regarding the roadblocks of converting the code build in C++ Builder 6,2007 to C++ Builder XE? The big change is the default string in XE is UnicodeString rather than AnsiString. All VCL String properites (Text, etc.) are Unicode in XE. There are good white papers regarding making this transition on the Embarcadero EDN site. I found that most of the changes I had to make fell into two categories: 1) Places where I was using moving data from VCL properties to or from explicit AnsiString, but I could easily change to String, i.e. convert to Unicode. 2) Places where I had relied on the c_str() method to provide a "C" string. If I really needed a "C" string, I would explicitly use AnsiString. It's a good idea to minimize these instances. Joe On 6/20/2012 8:20 AM, Girish Duddu wrote: > Any information regarding the roadblocks of converting the code build in C++ Builder 6,2007 to C++ Builder XE? The big change is the default string in XE is UnicodeString rather than AnsiString. All VCL String properites (Text, etc.) are Unicode in XE. There are good white papers regarding making this transition on the Embarcadero EDN site. I found that most of the changes I had to make fell into two categories: 1) Places where I was using moving data fro...

BUG (or issue) with Indy, C++ Builder 2010 and C++ Builder XE [Edit]
To reproduce this issue you need a clean installation (from scratch, no additional components installed, no Indy update) of C++ Builder 2010 or XE. It uses Indy 10.5.5 (with 2010) or 10.5.7 (with XE). Note: although it uses Indy to reproduce the issue, the version of Indy and Indy itself is not the one that causes this problem but the linking of C++ binary probably. Steps to reproduce: 1. Create a simple text file with the following content. Save it as "file.txt" or any other name. It can be also full email message but the text below is enough. {code} Subject: =?windows-125...

Can someone please help me to get started on installing c++ builder 5.5?
Hi, I'm new at this and have just downloaded C++ Builder 5.5 and don't understand the readme files instructions. I'm running XP Pro. Charles Moore wrote: > Hi, > > I'm new at this and have just downloaded C++ Builder 5.5 and don't > understand the readme files instructions. I'm running XP Pro. Hi Charles Have a look at this article: http://dn.codegear.com/article/20997 Kind regards Asger > {quote:title=Charles Moore wrote:}{quote} > Hi, > > I'm new at this and have just downloaded C++ Builder 5.5 and don'...

compile error in CT_PUBLIC.H on C++ Builder 5 not in Builder 4
Hi anyone I'm getting 'improper use of typedef CS_COMMAND' when trying to compile CT_LIB stuff. extern CS_RETCODE CS_PUBLIC ct_dynsqlda PROTOTYPE(( CS_COMMAND *cmd, CS_INT type, SQLDA *dap, CS_INT operation )); It worked with Borland/inprise C++ builder 4, but not with 5? Has anyone solved problem? thanks Felix ...

Installation of Update1 for C++ Builder XE is failing
Hi, I get the Update option to install as soon as I start XE. But on clicking the Download and Install, I get the following error "--------------------------- Embarcadero RAD Studio XE - InstallAware Wizard --------------------------- Runtime error in setup script: Line 321: '' is not a valid integer value I'm facing a linker error with the resource file missing for the TeeChart component (not present under C:\Program Files\Embarcadero\RAD Studio\8.0\lib\win32\release), thought installing the update will fix this error. Thanks > {quote:title=Kasturi Arjun...

C++Builder 2010 and C++Builder XE2 in the same machine
Is it possible to install C++Builder 2010 and C++Builder XE2 in the same machine? Can they coexist? Hi Richard Richard Weber wrote: > Is it possible to install C++Builder 2010 and C++Builder XE2 in the same > machine? Can they coexist? I don't know about those two, but it is normally not a problem to have different version of C++ Builder on the same machine. It is how ever recommended that they be installed in the order they were released. Best regards Asger-P Richard Weber <> wrote: >Is it possible to install C++Builder 2010 and >C++Builde...

Problem with installing a Delphi component in C++ Builder XE
Hi everyone, I hope this is the right forum... I'm trying to install a delphi component (I only have the .pas sources) in C++ Builder XE. I went through the normal procedure (Components->Install a component; select the .pas files + Install in a new package; Package C++ Builder). I get a new project "namePackage.bpl" and I right-click on "Install". The compilation is succesful and I have a message saying that the new components have been installed and if I create a new project to use them, they are indeed available. The problem arrives when I try to compile this project since the .lib for the new package is missing. And I cannot add the path to the library since it was not generated as far as can see. No .lib and no .bpi. When I installed the package, only the .bpl was generated. I tried to change the Delphi compiler options on the package project to "Generate all C++ Builder files (including package libraries)" with no luck. I'm at lost here, is there an option missing here? What confuses me the most is that everything seems to work just fine during compilation. I only have two transtyping warnings on compilation and a "duplicate ressource" warning during linking. Thanks in advance for any advice you could give me. Julien > {quote:title=Julien Erny wrote:}{quote} > The problem arrives when I try to compile this project since the .lib for the new package is missing. And I cannot add the path to th...

C++Builder 2010: same old bugs.... goodbye, C++Builder.
I've tried the demo version, built my OCX, set the constrained size, and added some event handler. It works exactly like the old Borland CBuilder 6: the grab handles does not follow the constrained size, the OnCloseQuery and OnDestroy events are not fired, there's is not an OnAmbientChange event available. Building OCX is an important feature for us, as our customer needs them... so, if i were the one that take the final decision, i'll migrate to MS developement tools.... i'm not that one, but i'll strongly push in that direction. It's a shame, anyway. If you are courious about these bugs, then build an ActiveX library, an ActiveForm, and add to that form event handlers until you get this code: {code:cpp} void __fastcall TProva_OCX_2010::ActiveFormCreate(TObject *Sender) { this->OnCloseQuery = EventoCloseQuery; OutputDebugString("OnCreate"); } //--------------------------------------------------------------------------- void __fastcall TProva_OCX_2010::ActiveFormDestroy(TObject *Sender) { OutputDebugString("OnDestroy"); } //--------------------------------------------------------------------------- void __fastcall TProva_OCX_2010::EventoCloseQuery(TObject* Sender, bool &CanClose) { OutputDebugString("OnCloseQuery"); } //--------------------------------------------------------------------------- {code} Also set the constrained dimension for the ActiveForm, compile and place the OCX ...

Upgrading Code from C++ Builder 4 to C++ Builder 2007
I am working on project written in C++ Builder 4, it uses TMS Component pack. Now the TMS Component pack has been upgraded so i do not find any compatible version of TMS Component to use with C++ Builder 4. I need to upgrade my code from C++ Builder 4 to C++ Builder 2007. I want to know whether code written in C++ Builder 4 is feasible with C++ Builder 2007. Thanks Arshdeep wrote: > I want to know whether code written in C++ Builder 4 is feasible > with C++ Builder 2007. Feisible, but do take into account that there have been RTL/VCL changes between BCB4 and CB2007, so y...

problem of converting from C++ Builder 6 to C++ Builder 2007
Hi, A program which was developed by our partner was built fine with C++ Builder 6. Now I need to make some changes to it. We bought C++ Builder 2007 a few weeks ago. When I open the program with C++ Builder 2007, I was told that the project needs to be converted. I agreed. Then when I compile it, some errors happen: [BCC32 Error] ComCtrls.hpp(435): E2272 Identifier expected [BCC32 Error] ComCtrls.hpp(3880): E2272 Identifier expected [BCC32 Error] ComCtrls.hpp(4658): E2272 Identifier expected ...... Anybody has any idea how to fix it? Thanks, Allen In article <14040@f...

C++Builder 2006 stopped working after C++Builder 2009
Is there a way to key both IDEs (2006 & 2009) on the same computer while I complete software migration? Both compilers are installed on a Windows Vista Proffesional. Thanks, Roberto Hello, Roberto Meneghini wrote: > Is there a way to key both IDEs (2006 & 2009) on the same computer > while I complete software migration? yes, it works fine for me. What particular problem are you having? -- Moritz "Hey, it compiles! Ship it!" As soon as I launch the compiler, the following error message is displayed: "Exception EPackageRegistrationException in module coreide100.bpl at 000DCB21. Registration procedure, Cppproject.IDERegister in package c:\program Files\Borland\BDS\4.0\Bin\bcbide100.bpl raised exception class EOleSysErr: OLE error 80131040, ClassID: {F8FEDD39-E3CE-4B8D-A657-9CA24866881F} Do you want to attempt to load IDE package the next time BDS2006 is run?" After clicking on Yes, the following message is displayed: "Your current C++ Builder Package Output Directory is not part of your system path. In order to use runtime packages that are built into this directory, this directory needs to be on your path. However, it appears that your current system path is too long. Please manually edit your system path to remove unnecessary items. Directory to be added: c:\users\it.company\documents\borland Studio Projects\bpl" Any suggestions? Regards, Roberto "Morit...

C++ Builder XE wont start after installing Update1.exe
C++ Builder XE won't start after installing Update1.exe. The banner page start and as soon as the message "All design time packages are loaded" appears, the banner page disappear, no IDE and no error message. I can still see bds.exe in the task manager. I'm using WIn XP. Please help. ...

Naming new console project
When I attempt to create a new console project using project|"Add new project" there doesn't appear to be any way to actually specify the project name. The platform just uses the same name as an existing one, so I end up with multiple instances with the same name in the project list. Very confusing.. All I want to do is to create multiple projects with names of my choice. Could someone please point me to suitable help or explain what I'm not doing? TIA ...

Llicense, installations and other doubts regarding C++ Builder XE [Edit]
I’ve just downloaded and installed C++ Builder XE Trial under Win XP SP3. I have some doubts in case I buy the software (it would be C++ Builder XE Pro and I’m a single user): -------------------------------------------------------------------------------------------------------- 1 - How would I register the new license and get rid of the trial version? (I couldn’t find a menu item to "Register a definitive license") -------------------------------------------------------------------------------------------------------- 2 - Will I have to uninstall the trial version a...

sgcWebSockets for C++ Builder 6
The library documentation and the install readme says that the project, who was build for Delphi, works as well for C++ Builder. [http://www.esegece.com/manual/sgcWebSockets.pdf] a) All Delphi/C++Builder Versions: Add the directory {$DIR}\source to the library path How can I run delphi code in a C++ Builder Project? Is it possible? > {quote:title=Eliseu Martins Gomes wrote:}{quote} > The library documentation and the install readme says that the project, who was build for Delphi, works as well for C++ Builder. Most Delphi components are usable in C++Builder...

C++ Builder XE
I am assuming this is the latest version. Where can see what features are included in the Starter Edition? And what is left out? I have been a long time user of C++ Builder 6 Personal Edition, and sometimes find somethin gthat would be useful is missing. George. http://www.embarcadero.com/products/cbuilder/cbuilder-feature-matrix.pdf XE2 will appear shortly. ...

Install Builder #5
hello, I use PB 5.0.04. I make my application diskettes for Windows 3.11 platform. I've got 6 components. Generation comes OK. But when i install application with this diskettes some files are not copied ??? Thanks in advance. Try copying the diskettes to the hard drive (in sub-directories Disk1, Disk2, etc), and Install from there. There's a bug in IB 5.0.04 when installing from multiple floppies, sometimes files aren't copied properly. Simon Philippe Sylvestre wrote in message ... >hello, >I use PB 5.0.04. I make my application diskettes for Windows ...

Help Update 3 for Delphi XE and C++Builder XE
Help Update 3 for Delphi XE and C++Builder XE http://cc.embarcadero.com/Item/28256 Updated: Fri, 24 Jun 2011 18:52:00 GMT Is the update really new? > {quote:title=Ralf Stocker wrote:}{quote} > Help Update 3 for Delphi XE and C++Builder XE > http://cc.embarcadero.com/Item/28256 > Updated: Fri, 24 Jun 2011 18:52:00 GMT > > Is the update really new? I think so -- but it's nothing major. The update is really BIG though. Not worth it if you're in your cabin in the mountains with a 9600 baud modem connection. ...

How to get PowerBuider 5.03 and Install Builder 5.03
Hi: I have been surfing for a while the Powersoft Web Site but I still not find the way to upgrade my copy of PowerBuilder 5.01 to 5.03, and Install Builder. I know there's some corrections made to both. Could anyone help me. Thanks Hugo Teran hugot@satlink.com Hugo C�sar Ter�n wrote: > > Hi: > I have been surfing for a while the Powersoft Web Site but I still > not find the way to upgrade my copy of PowerBuilder 5.01 to 5.03, and > Install Builder. I know there's some corrections made to both. > Could anyone help me. > Thanks &g...

C++Builder XE and RAD Studio XE are now available
The new product info is live on the web sites, trial downloads are available, and the products will be available to purchase worldwide between now and Wednesday. http://www.embarcadero.com/products/cbuilder http://www.embarcadero.com/products/rad-studio Thanks, Tim -- Tim Del Chiaro Product Marketing - RAD Studio, Delphi, C++Builder, Delphi Prism and Delphi for PHP http://delphi-insider.blogspot.com Hm. I was waiting for the final release notes to appear before I'd make up my mind about the new XE-release - and here they are. I've bought every C++ Compiler Bor...

Project compatible with Builder 3 and Builder XE
Hello there, I've got a problem with a fairly old project based on Borland C++ Builder 3 which has to be ported into a Builder XE project, but still has to be used with the Builder 3 compiler now and then. Changing to the newer compiler wasn't that hard sofar, now the code has to be altered to fit the old compiler again. The main problem right now is that the Builder XE updates the dfm-files, causing Reading Form Errors in the old builder. I thought of having two sets of dfm files, one for the old and one for the new compiler. And then adding the matching form depending o...

Enum return value size mismatch in C++ Builder 5.5
Hi! I have been trying to do some maintenance on an old piece of software, written in C++ Builder 5.5 for Win32. I know this is old, but it relies on some external components and would probably be complicated to port to a newer environment. I have been trying to solve my problem by browsing through old posts using Google Groups, but so far have not been able to find anything. It uses several old DLLs, which when I got my hands on them were written for an even older version (Borland C++ 5.02). With the DLLs build with this version of the compiler, everything works fine. To avoid...

C++ Builder/Delphi 2009 and IndyTiburon 10.5.5 error
Hello, i installing the latest IndyTiburon package r3641. 1. There are a problem with the genarated header file /core/IdWinsock2.hpp when i will use the components: [BCC Error] IdWinsock2.hpp(88):E2040 [BCC Error] IdWinsock2.hpp(89):E2040 [BCC Error] IdWinsock2.hpp(90):E2040 [BCC Error] IdWinsock2.hpp(91):E2040 static const Word IPPORT_REGISTERED_MIN = 0x400; static const Word IPPORT_REGISTERED_MAX = 0xbfff; static const Word IPPORT_DYNAMIC_MIN = 0xc000; static const Word IPPORT_DYNAMIC_MAX = 0xffff; I comment them out ! and it work fine ! But can i get any other Problems ? 2. I compiled the packages with the ide I have create an ProjectFile with the following entries: IndySystem120.bpl -- runtimePackage IndyCore120.bpl -- runtimePackage dclIndyCore120.bpl -- designtimePackage IndyProtocols120.bpl -- runtimePackage dclIndyProtocols120.bpl -- designtimePackage Then i must set in all Package Options->Copmiler->Debugger->Assertion to false otherwise i get runtime error( exception assertion failed ) only with the C++ Builder programs ind Delphi it works fine with Assertion = true. Is that correct ? Regards, Sascha Michel <Sascha Michel> wrote in message news:117064@forums.codegear.com... > i installing the latest IndyTiburon package r3641. The current is snaphost is rev 3646. > There are a problem with the genarated header file /core/IdWinsock2.hpp > when i will use the co...

Web resources about - C++ Builder 5 to Builder XE - embarcadero.cppbuilder.install

Associated Builders and Contractors - Wikipedia, the free encyclopedia
^ "ABC Strategic Partnership - Maxwell Systems" . Maxwell Systems, Inc . Retrieved July 10, 2013 . Text is available under the Creative Commons ...

Cheezburger Builder Turns Facebook Photos Into Memes
... the Internet love using Cheezburger to turn photos into memes , but now users can connect their Facebook accounts into the Cheezburger Builder ...

JetSet Secrets, MeuChip, Cinemagram, Jurassic Park Builder and more on this week’s emerging Facebook ...
... Deluxe 790,000 +90,000 + 13% 10. High 5 Casino 318,775 +81,001 + 34% 11. Talkatone 240,000 +80,000 + 50% 12. Jurassic Park Builder ...

Dream Builders (@NBCDreamBuilder) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Business Builders Community
Business Builders is a group for professionals who are business and entrepreneur minded who understand the power and value of networking to grow ...

Retro Car Builder 3D Free - Custom Body Shop and Classic Car Cruiser for iPhone 3GS, iPhone 4, iPhone ...
Get Retro Car Builder 3D Free - Custom Body Shop and Classic Car Cruiser on the App Store. See screenshots and ratings, and read customer reviews. ...

How to avoid dodgy builders
NSW Fair Trading offers some tips and things to look out for to avoid being scammed by shonky builders.

How to avoid dodgy builders
NSW Fair Trading offers some tips and things to look out for to avoid being scammed by shonky builders.

Scissor lifts banned as RAH builders resume work
WORKERS at the new Royal Adelaide Hospital will return today but will stop using scissor lifts after the death of a grandfather in a second industrial ...

GSO Capital extends $US957m lifeline to Arrium as subs builders look to Whyalla
GSO Capital Partners, an arm of Blackstone, will provide embattled steel and iron ore group Arrium with up to $US927 million as part of a mu ...

Resources last updated: 3/15/2016 7:25:46 PM