 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Alan Garny Guest
|
Posted: Wed Dec 20, 2006 9:10 am Post subject: Use a C++ library within Delphi |
|
|
Below is a message I posted on b.p.d.non-technical, but there is a technical
bit that might benefit from being posted on this newsgroup, so...
Cheers, Alan.
-------------------
I can't seem to find an appropriate newsgroup for the problem a colleague of
mine and I are facing, so here goes...
My colleague has developed a library in C++, which I would like to use
within my Delphi application. Because he doesn't use, and doesn't intend to
use, any of Borland tools, he thought he would make me a favour and compile
his C++ library using the free command line tools (version 5.5 of the C++
compiler).
After a bit of struggle, he eventually got his library to compile (kudos to
him!), but now I am the one facing problems. I thought I would start by
compiling a small C++ console program that he wrote. Having BDS 2006, I have
version 5.82 of the C++ compiler and that's where the problem is: I get
unresolved symbols. It would seem that the latest version of the C++
compiler uses the "Dinkumware" implementation of the C++ STL, causing an
incompatibility between the free C++ compiler (5.5) and the one available
within BDS 2006 (5.82).
A possible way to solve this problem would be to use the cw32mt.lib file
from the free C++ compiler. This version of the library would then provide
the symbols needed for BDS 2006's C++ compiler. However, before we can do
that, we need to make sure that cw32mt.lib is a "redistributable file" under
the free C++ compiler license agreement. The question, therefore, is to know
whether or not cw32mt.lib is a redistributable file and, if not, what can we
do to get the library to be compatible with BDS 2006's C++ compiler?
Cheers, Alan.
PS: at some point, I thought I could get my colleague to try compile his
library using the Turbo C++ Explorer compiler, but we don't seem to be able
to download it (not to mention that the CodeGear website refers to Turbo C
Explorer as opposed to Turbo C++ Explorer). Have the Turbo Explorer versions
been removed (one can still get an activation key though)? |
|
| Back to top |
|
 |
vavan Guest
|
Posted: Wed Dec 20, 2006 9:10 am Post subject: Re: Use a C++ library within Delphi |
|
|
On Wed, 20 Dec 2006 04:05:00 -0000, "Alan Garny"
<someone (AT) somewhere (DOT) com> wrote:
| Quote: | Below is a message I posted on b.p.d.non-technical, but there is a technical
|
please see my reply in b.p.d.n-t
--
Vladimir Ulchenko aka vavan |
|
| Back to top |
|
 |
Ed Mulroy Guest
|
Posted: Wed Dec 20, 2006 9:10 am Post subject: Re: Use a C++ library within Delphi |
|
|
To do that make functions either __fastcall or __stdapi. If __stdcall then
make sure that their declarations in Delphi also say stdcall. Use an obj
file and not a lib. Also use no compiler-supplied libraries, do not throw
exceptions and do not use try and catch.
It is easier if you just make a DLL and let Delphi call functions that it
exports.
.. Ed
| Quote: | Alan Garny wrote in message
news:4588b62c$1 (AT) newsgroups (DOT) borland.com...
Below is a message I posted on b.p.d.non-technical, but there is a
technical bit that might benefit from being posted on this newsgroup,
so...
-------------------
I can't seem to find an appropriate newsgroup for the problem a colleague
of
mine and I are facing, so here goes...
My colleague has developed a library in C++, which I would like to use
within my Delphi application. Because he doesn't use, and doesn't intend
to
use, any of Borland tools, he thought he would make me a favour and
compile
his C++ library using the free command line tools (version 5.5 of the C++
compiler).
After a bit of struggle, he eventually got his library to compile (kudos
to
him!), but now I am the one facing problems. I thought I would start by
compiling a small C++ console program that he wrote. Having BDS 2006, I
have
version 5.82 of the C++ compiler and that's where the problem is: I get
unresolved symbols. It would seem that the latest version of the C++
compiler uses the "Dinkumware" implementation of the C++ STL, causing an
incompatibility between the free C++ compiler (5.5) and the one available
within BDS 2006 (5.82).
A possible way to solve this problem would be to use the cw32mt.lib file
from the free C++ compiler. This version of the library would then provide
the symbols needed for BDS 2006's C++ compiler. However, before we can do
that, we need to make sure that cw32mt.lib is a "redistributable file"
under
the free C++ compiler license agreement. The question, therefore, is to
know
whether or not cw32mt.lib is a redistributable file and, if not, what can
we
do to get the library to be compatible with BDS 2006's C++ compiler?
Cheers, Alan.
PS: at some point, I thought I could get my colleague to try compile his
library using the Turbo C++ Explorer compiler, but we don't seem to be
able
to download it (not to mention that the CodeGear website refers to Turbo C
Explorer as opposed to Turbo C++ Explorer). Have the Turbo Explorer
versions
been removed (one can still get an activation key though)? |
|
|
| Back to top |
|
 |
Alan Garny Guest
|
Posted: Thu Dec 21, 2006 12:44 am Post subject: Re: Use a C++ library within Delphi |
|
|
"Ed Mulroy" <dont_email_me (AT) bitbuc (DOT) ket> wrote in message
news:4588ccaf$1 (AT) newsgroups (DOT) borland.com...
| Quote: | To do that make functions either __fastcall or __stdapi. If __stdcall
then make sure that their declarations in Delphi also say stdcall. Use an
obj file and not a lib. Also use no compiler-supplied libraries, do not
throw exceptions and do not use try and catch.
|
Thanks a lot, that is useful information! This is not my C++ library, but I
will definitely forward that information to my colleague.
| Quote: | It is easier if you just make a DLL and let Delphi call functions that it
exports.
|
If at all possible, I would very much like to avoid having to use a DLL.
Cheers, Alan. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|