Board index » delphi » Delphi GUI & C++ Everything else

Delphi GUI & C++ Everything else

I was just curious about using Delphi and C++ together.

How easy is it to merge the two i.e. create the user interface with
Delphi and create everything else with C++?

Is there any advantage to doing this?

I would imagine there's a reason why this capability was incorporated
into Delphi so maybe there are some situations where C++ code would be
used.  

When would it be a good idea to incorporate C++ into a delphi program?

Thanks,

/tj/

 

Re:Delphi GUI & C++ Everything else


Quote
redl...@infi.net (Vincent Taijeron) wrote:
>I was just curious about using Delphi and C++ together.
>How easy is it to merge the two i.e. create the user interface with
>Delphi and create everything else with C++?

On a scale of 1 to 10, not very easy. It depends on where/how you draw
the line between the two bits of code. If you can split the system
into loosely coupled modules then you may be OK. Nowadays there are
zillions of ways to do this, but they all have a greater or lesser
overhead. I'm thinking of a range from DLL, OCX, DDE, to OLE (etc)

Quote
>Is there any advantage to doing this?

Yes, if:
1. You've got 250,000 lines of C++ code already written.
2. You have one Delphi proggie but lots of C++ coders.
3. You find the online help in C++ to be soo much better than Delphi.
4. You love C++/hate Delphi.
5. You want to apply for C++ jobs.

These are 'project managment' reasons though. You can do anything in
Delphi you can in C++, so I can't think of any outstanding technical
reasons for using C++.

Quote
>I would imagine there's a reason why this capability was incorporated
>into Delphi so maybe there are some situations where C++ code would be
>used.  
>When would it be a good idea to incorporate C++ into a delphi program?

Well I hate C++ so "never" is my answer.

--
Bob Cousins, Software Engineer.
http://www.demon.co.uk/sirius-{*word*104}netics/

Re:Delphi GUI & C++ Everything else


Quote
Vincent Taijeron wrote:
> How easy is it to merge the two i.e. create the user interface with
> Delphi and create everything else with C++?Ranges from quite easy to difficult.  Depends on how you break it up,

and how you interface.  For example, calling C++ DLLs is cake.  Try to
access a C++ object directly from Delphi and you may have trouble
(never tried this).

Quote
> Is there any advantage to doing this?Use the proper tools for the job.  Delphi excels in interface design.  

C/C++ excels in other areas.  

Quote
> When would it be a good idea to incorporate C++ into a delphi program?There is a lot of number crunching code in C and C++.  Why reinvent the

wheel?  The optimizing engines for C/C++ have been around longer; my
guess is that they are superior.

The drawback is that you have two development environments.  You must
distribute double sets of runtime libraries.  You probably must have
someone that understands both pascal and C++.

Paul

Re:Delphi GUI & C++ Everything else


{snip}

Quote
>The drawback is that you have two development environments.  You must
>distribute double sets of runtime libraries.  You probably must have
>someone that understands both pascal and C++.

No actually I am just curious.  It was mentioned in the literature so
I was wondering if Delphi can do everything C can do then why would
you want to integrate the two.

As many people have pointed out to me part of the reason may be that
they already have many lines of C code they don't want to see go to
waste.

Just wondering.

/tj/

Re:Delphi GUI & C++ Everything else


You know what I think? DLL. I needed a certain routine, that was already
written in C++ and compiled to a DLL. I called it fomr Delphi...it was
easy as hell. I highly recommend using DLLs written in C++ when needing
C++ routines.
 --

                                \\\\
                                 0 0
                                 \=/
                     http://www.charm.net/~tekhed              

Re:Delphi GUI & C++ Everything else


Quote
Bob Cousins wrote:

> These are 'project managment' reasons though. You can do anything in
> Delphi you can in C++, so I can't think of any outstanding technical
> reasons for using C++.

Eh. Nope. Multiple inheritance. Templates. (Function/operator
overloading, but that's just syntactic sugar anyway)

MI isn't really necessary, since what it really does is provide
several interfaces to one object. So, instead of MI, you could
do a 'give me this interface' function (this is what COM does,
in fact COM doesn't have inheritance at all...).
Templates would be nice though.

M.

--
Martin Larsson, author of several unknown utilities for DOS and Windows.
mailto:martin.lars...@delfi-data.msmail.telemax.no
http://www.delfidata.no/users/~martin
X.400:G=martin;S=larsson;O=delfi-data;P=msmail;A=telemax;C=no

Re:Delphi GUI & C++ Everything else


"Paul A. Billings" <p...@mrtc.org> wrote:

Quote
>Vincent Taijeron wrote:
>> How easy is it to merge the two i.e. create the user interface with
>> Delphi and create everything else with C++?Ranges from quite easy to difficult.  Depends on how you break it up,
>and how you interface.  For example, calling C++ DLLs is cake.  Try to
>access a C++ object directly from Delphi and you may have trouble
>(never tried this).

Delphi 2.0 supports direct linking of .OBJ files.  This means you can
actually compile C/C++ code into your Delphi apps directly (or vice
verse).  Obviously there are various issues with this
(string-handling, name-mangling, etc...) but it is supported.

Quote
>> Is there any advantage to doing this?Use the proper tools for the job.  Delphi excels in interface design.  
>C/C++ excels in other areas.  
>> When would it be a good idea to incorporate C++ into a delphi program?There is a lot of number crunching code in C and C++.  Why reinvent the
>wheel?  The optimizing engines for C/C++ have been around longer; my
>guess is that they are superior.

Actually Delphi 2.0 uses the same backend compiler/optimizer as the
latest version of Borland C++.  I have heard that C/C++ is only 10-15
percent faster than Delphi for most processing.

---------------------------------------------------------------
Dylan Steinberg
Integrated Systems Consulting Group

dy...@voicenet.com

Re:Delphi GUI & C++ Everything else


In message <4sucnu$...@goodnews.voicenet.com>, dy...@voicenet.com (Dylan Steinberg) said:

Quote
> Delphi 2.0 supports direct linking of .OBJ files.  This means you can
> actually compile C/C++ code into your Delphi apps directly (or vice
> verse).  Obviously there are various issues with this
> (string-handling, name-mangling, etc...) but it is supported.

The name-mangling issue is not a trivial one. The names are deliberately mangled
into forms that are not legal C/C++ names (otherwise collisions would be possible).
I'm pretty sure that the resultant names are not legal Pascal either.

There are ways around the problem, but it's not quite plug'n'play.

-----------------------------------------------------------------------
Steve Rencontre               |  st...@dstrip.demon.co.uk (business)
If it works, it's obsolete.   |  steve...@cix.compulink.co.uk (private)
-----------------------------------------------------------------------

Re:Delphi GUI & C++ Everything else


On Sun, 21 Jul 1996 23:00:41 GMT, dy...@voicenet.com (Dylan Steinberg)
wrote:

Quote
>>> How easy is it to merge the two i.e. create the user interface with
>>> Delphi and create everything else with C++?Ranges from quite easy to difficult.  Depends on how you break it up,
>>and how you interface.  For example, calling C++ DLLs is cake.  Try to
>>access a C++ object directly from Delphi and you may have trouble
>>(never tried this).

Ok - we certanily can agree that it ain't diffucult to call DLL's  -
but how about dataexchange ??

If Delphi got the DB-access and you need to inform your C++ part about
(alot of) this data ?

Example:
You got some projectmanagement database (projekts, human-resources and
such )
The C++ part need to now about this (will build up it's own
datastructure with this information) - how do you do that most
effective ??

Re:Delphi GUI & C++ Everything else


Quote
In article <31ed82ed.1013...@news.foto.infi.net>, redl...@infi.net (Vincent Taijeron) writes:
> {snip}

> >The drawback is that you have two development environments.  You must
> >distribute double sets of runtime libraries.  You probably must have
> >someone that understands both pascal and C++.

> No actually I am just curious.  It was mentioned in the literature so
> I was wondering if Delphi can do everything C can do then why would
> you want to integrate the two.

> As many people have pointed out to me part of the reason may be that
> they already have many lines of C code they don't want to see go to
> waste.

> Just wondering.

> /tj/

Actually, one motivation for me would be as follows:

I own Borland C++ 4.5 which can build 32-bit programs, but doesn't
know about Windows 95 specific controls (in fact, BC++ 4.5 is light
on *any* controls except basic Win16 controls).

I bought Delphi 2.0 for application development. It comes with alot
of controls WIn95 and others. Now suppose I have an existing C++ app that
I want to port to Win95 I can either (a) upgrade BC++ to 5.0 @$300 if
I want the developer version, or (b) I can save my $300, build my UI
with Delphi and just link to it with BC++ 4.5.

Not elegant, but an economic argument.

Mark

Re:Delphi GUI & C++ Everything else


Quote
Mark Bratcher wrote:
> Actually, one motivation for me would be as follows:

> I own Borland C++ 4.5 which can build 32-bit programs, but doesn't
> know about Windows 95 specific controls (in fact, BC++ 4.5 is light
> on *any* controls except basic Win16 controls).

> I bought Delphi 2.0 for application development. It comes with alot
> of controls WIn95 and others. Now suppose I have an existing C++ app that
> I want to port to Win95 I can either (a) upgrade BC++ to 5.0 @$300 if
> I want the developer version, or (b) I can save my $300, build my UI
> with Delphi and just link to it with BC++ 4.5.

> Not elegant, but an economic argument.

> Mark

FWIW, I received the free update to BC++ 4.52 which does understand the
win32 controls.  Of course they're not available in the resource editor
:-(, but you can create them dynamically just fine.  Use a 3rd party
resedit (say, ummm... Microsoft's?) and you're fine.  Again, FWIW.  
Also, 4.51/4.52 are much more stable than 4.50, so press for your free
upgrade.

Paul

Other Threads