Board index » delphi » Re: Delphi 2006 with C++ Builder

Re: Delphi 2006 with C++ Builder


2005-11-24 06:38:08 PM
delphi76
Mike B napisa?a):
[...]
Quote
Michal Zaborowski stated that you can "build" a BPL into an executable.

At home I have newsreader configured differently. TeXXaS is my nick -
convention in bridge...
Quote

But if he thinks that building without packages is the same as building a
"BPL" into your executable then he is mistaken. What gets built into the
executable are DCU's, not BPLs.

DCP are good as well - but still Builder can't generate them.
I have terrible day yesterday ;)
--
Regards,
Michal Zaborowski (TeXXaS)
 
 

Re: Delphi 2006 with C++ Builder

Dnia 2005-11-24 10:53, Użytkownik Pete Goodwin napisa?:
[...]
Quote

The DLL exports C code, not C++.

There is difference between Delphi and C++ in exporting /
importing. In C++ you need only to export methods. Then you
can create LIB file on DLL. In Delphi you have common VMT.
If you do not need to exchange objects between app and lib -
all works. But using frames is not possible. TFrame from DLL
has different pointer to its VMT then in EXE so 'is' 'as'
operations fails.
That is why BPL are better. They sync VMTs across exe and
loaded libraries. You need to build exe with runtiome libraries.
To build single file (EXE) as output you need DCUs or DCP
(Delphi Compiled Package) - as I mentioned before. Builder
creates its own files - try to use them.
Quote
What I would like to do is create an
object or library and link it in with Delphi. I guess
that's still not possible yet without an RTL for C in Delphi.

Try link Builder's OBJs into your EXE. Mike B proposed it
in cleaner way ;)...
I hope in new D2006 both languages will work closer.
--
Regards,
Michal Zaborowski (TeXXaS)
 

Re: Delphi 2006 with C++ Builder

TeXXaS writes:
Quote
Dnia 2005-11-24 10:53, Użytkownik Pete Goodwin napisa?:

[...]
>
>The DLL exports C code, not C++.
>
There is difference between Delphi and C++ in exporting /
importing. In C++ you need only to export methods. Then you
can create LIB file on DLL. In Delphi you have common VMT.
If you do not need to exchange objects between app and lib -
all works. But using frames is not possible. TFrame from DLL
has different pointer to its VMT then in EXE so 'is' 'as'
operations fails.
That is why BPL are better. They sync VMTs across exe and
loaded libraries. You need to build exe with runtiome libraries.
To build single file (EXE) as output you need DCUs or DCP
(Delphi Compiled Package) - as I mentioned before. Builder
creates its own files - try to use them.
As I have said before, this is a C DLL with no VCL. It does use C runtime
functions which are undefined in Delphi when I link them as OBJ files.
Quote

>What I would like to do is create an
>object or library and link it in with Delphi. I guess that is still
>not possible yet without an RTL for C in Delphi.
>
Try link Builder's OBJs into your EXE. Mike B proposed it
in cleaner way ;)...

I hope in new D2006 both languages will work closer.
So do I. However, it doesn't seem to be the case.
--
Pete Goodwin
Cheesed off Kylix, C++ Builder V6 and Delphi 2005 owner
 

Re: Delphi 2006 with C++ Builder

Pete
How many C RTL functions are you using, and which ones.
If there are not too many (eg ZLib needs around 4 or 5), then you have a
reasonably good chance of being able to do a direct link.
If there are lots and lots of them, then it is probably best to stick with
the DLL. It all depends on how much work that you are prepared to do. The
fact that you are not using C++ classes already makes it much easier.
You can try and replace your C RTL functions with Delphi equivalents. Get
rid of the included header files and declare all the ones that you use as
external with the exact Delphi name.
regards
Mike
"Pete Goodwin" <XXXX@XXXXX.COM>writes
Quote
TeXXaS writes:

>Dnia 2005-11-24 10:53, Użytkownik Pete Goodwin napisa?:
>
>[...]
>>
>>The DLL exports C code, not C++.
>>
>There is difference between Delphi and C++ in exporting /
>importing. In C++ you need only to export methods. Then you
>can create LIB file on DLL. In Delphi you have common VMT.
>If you do not need to exchange objects between app and lib -
>all works. But using frames is not possible. TFrame from DLL
>has different pointer to its VMT then in EXE so 'is' 'as'
>operations fails.
>That is why BPL are better. They sync VMTs across exe and
>loaded libraries. You need to build exe with runtiome libraries.
>To build single file (EXE) as output you need DCUs or DCP
>(Delphi Compiled Package) - as I mentioned before. Builder
>creates its own files - try to use them.

As I have said before, this is a C DLL with no VCL. It does use C runtime
functions which are undefined in Delphi when I link them as OBJ files.

>
>>What I would like to do is create an
>>object or library and link it in with Delphi. I guess that is still
>>not possible yet without an RTL for C in Delphi.
>>
>Try link Builder's OBJs into your EXE. Mike B proposed it
>in cleaner way ;)...
>
>I hope in new D2006 both languages will work closer.

So do I. However, it doesn't seem to be the case.

--
Pete Goodwin
Cheesed off Kylix, C++ Builder V6 and Delphi 2005 owner
 

Re: Delphi 2006 with C++ Builder

Mike B writes:
Quote
Pete

How many C RTL functions are you using, and which ones.
There weren't that many.
Quote
If there are not too many (eg ZLib needs around 4 or 5), then you
have a reasonably good chance of being able to do a direct link.

If there are lots and lots of them, then it is probably best to stick
with the DLL. It all depends on how much work that you are prepared
to do. The fact that you are not using C++ classes already makes it
much easier.

You can try and replace your C RTL functions with Delphi equivalents.
Get rid of the included header files and declare all the ones that
you use as external with the exact Delphi name.
Now there's an idea!
--
Pete Goodwin
 

Re: Delphi 2006 with C++ Builder

Mike B writes:
Quote
How many C RTL functions are you using, and which ones.
Just two!
_strncmp
_memchr
I removed the header files and defined Delphi versions of them. Voila!
My DLL is now integrated into the main application.
Thanks!
--
Pete Goodwin
 

Re: Delphi 2006 with C++ Builder

So, people, is there _any_ way to show the content of any visual
component in an exe file written in delphi, but the component to show
is from a DLL written in BC or VC?
I would like to make a little utility, and I want to make it possible
to show some controls on its GUI from other people's DLL. TFrame,
TPanel, any class are welcome, just tell me please, what do I have to
do, to make it work?
Thank You Guys