Board index » cppbuilder » replacing the STL implementation in BC++5.0x

replacing the STL implementation in BC++5.0x


2007-04-13 02:26:43 PM
cppbuilder36
Hello,
I am working on an application built with BCB5 that uses a couple of DLL's
that are built with Borland C++ 5.0. I've converted most of the old DLL's
from BC++5.0 over to BCB, but for reasons I won't go into, I still have a
couple of DLL's that must continue to be built with BC++5.0.
Today I started making some changes in a couple of structures that are
shared between the EXE and one of the DLL's, but am encountering runtime
errors. I've added vectors to a couple of my structures, and when I attempt
to perform certain operations on these vectors, the application blows up (I
get "C++ Exception" errors), which I believe is being caused by the fact
that BCB5 and BC++5.0 use different versions of the HP/RogueWave STL, and
are therefore getting confused/clobbered by each other.
I think the problem can be resolved if both compilers could be made to use
the same STL implementation. So what I would like to do is replace the STL
in BC++5.0 with that which is used in BCB5. However, I have no idea how to
go about doing this. Has anyone done this (successfully!) before that could
explain what I must do?
Thanks a lot,
- Dennis
 
 

Re:replacing the STL implementation in BC++5.0x

Dennis Jones wrote:
Quote
Hello,

I am working on an application built with BCB5 that uses a couple of DLL's
that are built with Borland C++ 5.0. I've converted most of the old DLL's
from BC++5.0 over to BCB, but for reasons I won't go into, I still have a
couple of DLL's that must continue to be built with BC++5.0.

Today I started making some changes in a couple of structures that are
shared between the EXE and one of the DLL's, but am encountering runtime
errors. I've added vectors to a couple of my structures, and when I attempt
to perform certain operations on these vectors, the application blows up (I
get "C++ Exception" errors), which I believe is being caused by the fact
that BCB5 and BC++5.0 use different versions of the HP/RogueWave STL, and
are therefore getting confused/clobbered by each other.

I think the problem can be resolved if both compilers could be made to use
the same STL implementation. So what I would like to do is replace the STL
in BC++5.0 with that which is used in BCB5. However, I have no idea how to
go about doing this. Has anyone done this (successfully!) before that could
explain what I must do?

Thanks a lot,

- Dennis


Hello, Dennis,
when building with BCB5, are you using the -Vl compiler switch?
---
This is a backward compatibility switch that causes the BCC32 C++
compiler to lay out derived classes the same way it did in older
versions of Borland C++. Enable this option if you need to compile
source files that you intend to use with older versions of Borland C++
(for example, if you need to work with a .DLL that you cannot recompile,
or if you have older data files that contain hardwired class layouts).
---
Jogy
 

Re:replacing the STL implementation in BC++5.0x

"Jogy" < XXXX@XXXXX.COM >wrote in message
Quote
Hello, Dennis,

when building with BCB5, are you using the -Vl compiler switch?
---
This is a backward compatibility switch that causes the BCC32 C++ compiler
to lay out derived classes the same way it did in older versions of
Borland C++. Enable this option if you need to compile source files that
you intend to use with older versions of Borland C++ (for example, if you
need to work with a .DLL that you cannot recompile, or if you have older
data files that contain hardwired class layouts).
Hmm...I don't see that documented on the command line compiler's syntax
statement. Are you saying that the problem may not be the STL
implementation at all, but class/struct layout? I've been sharing
structures between BCB and BC++ for a long time (6-7 years), and this is the
first time I've ever had any trouble (I've never shared any data type, like
AnsiString, that BC++ didn't know about). And I have both compilers' set to
align data on a 1-byte boundary, so I know that isn't the cause. This
problem didn't come up until I added a vector to the structures.
I will give the -V1 switch a try and then post the results.
- Dennis
 

{smallsort}

Re:replacing the STL implementation in BC++5.0x

"Dennis Jones" < XXXX@XXXXX.COM >wrote in message
Quote

I will give the -V1 switch a try and then post the results.
Well, -V1 caused compiler errors when processing deque.h. Then I noticed
that it was -Vl (el) not -V1 (one), which makes sense (l=layout). I presume
that I must use -Vl for the EXE and all DLL's I build with BCB? I tried
just changing the one project that uses the functions that reference the
structures in question, but I got startup errors when I ran the program. So
I guess I'll go back and change all of the projects and try again.
- Dennis
 

Re:replacing the STL implementation in BC++5.0x

"Dennis Jones" < XXXX@XXXXX.COM >wrote in message
Quote

"Dennis Jones" < XXXX@XXXXX.COM >wrote in message
news:461f93f9$ XXXX@XXXXX.COM ...
>
>I will give the -V1 switch a try and then post the results.

Well, -V1 caused compiler errors when processing deque.h. Then I noticed
that it was -Vl (el) not -V1 (one), which makes sense (l=layout). I
presume that I must use -Vl for the EXE and all DLL's I build with BCB? I
tried just changing the one project that uses the functions that reference
the structures in question, but I got startup errors when I ran the
program. So I guess I'll go back and change all of the projects and try
again.
Setting the -Vl (el) flag for all my projects caused lots of other runtime
issues. But in the middle of the night (as usual) I thought of a solution
that I believe will solve my original problem. I am going to leave the
structures alone so that I don't change the interface with the old BC++
DLL's. Then in BCB, derive new classes from the old structures and use them
in BCB exclusively (the vectors don't actually need to be transfered to/from
the old DLL). That way I won't have to worry about different STL
implementations between the compilers.
- Dennis