Board index » delphi » Using C++ in Delphi

Using C++ in Delphi


2005-03-16 08:33:41 AM
delphi246
Hi,
I would like to use C++ code in Delphi. The C++ code is being developed by another project so porting it to Delphi is out of the question.
I've read the article that describes how to use C++ DLLs in Delphi. However, I'd like keep the Delphi program stand-alone so the users can just copy the .exe without worring about copying the DLLs. Is there anyway to do it? (eg. somehow statically link the DLL inside the Delphi's .exe)
I appreciate any suggestions.
 
 

Re:Using C++ in Delphi

Artur Kedzierski writes:
Quote
I would like to use C++ code in Delphi. The C++ code is being
developed by another project so porting it to Delphi is out of the
question.
I appreciate any suggestions.
It's either impossible (or at least very difficult) to link C++ code
into Delphi. It is possible however, to link C .OBJ files:
rvelthuis.bei.t-online.de/articles/articles-cobjs.htm
Thanks Rudy <g>
--
Dave Nottage [TeamB]
 

Re:Using C++ in Delphi

"Artur Kedzierski" wrote
Quote

I appreciate any suggestions.
Bit of a kludge, but you could compile in the dll as a resource, and then in
program startup, check for the existence of the file, and if not present
extract it. For this to work you need to bind to the dll dynamically. Not
pretty, but does accomlish the goal of "users can just copy the .exe."
bobD
 

Re:Using C++ in Delphi

Artur Kedzierski writes:
Quote

Hi,

I would like to use C++ code in Delphi. The C++ code is being
developed by another project so porting it to Delphi is out of the
question.

I've read the article that describes how to use C++ DLLs in Delphi.
I guess that was mine. I have heard of using C++ object files in Delphi
as well, but can not find the exact data anymore. Someone in this group
pointed me to it.
--
Rudy Velthuis [TeamB] rvelthuis.bei.t-online.de
"There are only two tragedies in life: one is not getting what one
wants,
and the other is getting it."
- Oscar Wilde (1854-1900)
 

Re:Using C++ in Delphi

It also depends on the C++ compiler being used IIRC. Borland and MS produce
.obj files in different formats (COFF and OMF).
The two don't mix natively either.
Here's the FAQ for a tool that will turn a DLL in to a static library. It
mentions using the lib in Borland C++ so there may be tools to convert
between formats.
www.binary-soft.com/faq.htm
It might be worth looking in to further.
Vince Bartlett
"Artur Kedzierski" <XXXX@XXXXX.COM>writes
Quote

Hi,

I would like to use C++ code in Delphi. The C++ code is being developed by
another project so porting it to Delphi is out of the question.

<snip>
 

Re:Using C++ in Delphi

"Artur Kedzierski" <XXXX@XXXXX.COM>writes
Quote

Hi,

I would like to use C++ code in Delphi. The C++ code is being developed by
another project so porting it to Delphi is out of the question.

I've read the article that describes how to use C++ DLLs in Delphi.
However, I'd like keep the Delphi program stand-alone so the users can
just copy the .exe without worring about copying the DLLs. Is there anyway
to do it? (eg. somehow statically link the DLL inside the Delphi's .exe)
Quote

I appreciate any suggestions.
You can do the reverse. Use Delphi to create what you want and link this
into C++ Builder (if they are using Builder). Works pretty well actually
(caveat: I haven't tried it on large projects however).