Forum > Other

Lazarus and C++ ?

(1/2) > >>

chris.gordon-smith:
Lazarus certainly looks like an interesting project. My problem is that I have a substantial amount of code that's written in C++Builder and Kylix C++. Borland seems to have lost interest in supporting users of these products. C++BuilderX is a mammoth package, but I can't use it to build my existing project. Its a bizarre situation, but there it is.

Lazarus looks like the solution for Delphi users. What about C+? Would it be possible for C++ code to interface to the Lazarus code so that C++ users could take advantage of the object pascal components? Given that C++ Builder does something like this, I would have thought that it may be a possibility.

Any comments welcome. I have read the FAQ entry that says there is no plan for C++ support, but I would have thought that it should be possible.

Chris Gordon-Smith
http://graffiti.virgin.net/c.gordon-smith/

Anonymous:
Its easy for Borland to do that cause they write their own compilers. You cant mix and match MS visual c++ and Delphi so I doubt you can do the same with FPC/Gcc in the same manner.

We would need support for Corba / Orbits to do what u want but FPC does not support Corba yet (plus a rewrite of the LCL components to use Corba interfaces). If and when thats done then it would be able to support any language that uses corba including c++ and others... (in the same way com components can be used on ms platforms).

chris.gordon-smith:
Thanks for these comments. As you say, Borland C++ has special language features to support the integration with Delphi. The 'pascalimplementation' declaration modifier is one of these. Clearly this language feature won't exist in a non Borland C++ compiler such as gcc. However, if it were possible to understand how the interface works, then I wonder whether it might be possible to re-engineer it in a gcc / Lazarus environment using language features that do exist. For example, whatever calling interface is required by fpc can presumably in prinpiple be satisfied in a C++ environment, even if one has to resort to the use of assembler code to achieve this.

No doubt the Corba approach offers a better and more generic solution. However, in the meantime I and a lot of other Borland BCB and Kylix (C++) face  the prospect of code that has been developed over several years becoming unsupportable if Borland do drop VCL and CLX.

An integration between Lazarus and C++ would therefore be of great interest.

Chris Gordon-Smith
http://graffiti.virgin.net/c.gordon-smith/

Anonymous:
check out the fpc future plans at :

http://www.freepascal.org/future.html

It mentions the possibility of linking with c++ code in future versions. Still u should post your question to one of the FPC team (see http://www.freepascal.org/moreinfo.html).

chris.gordon-smith:
Thanks for the links. As you say, there is a plan for linking with C++ in a future release. However, I'm not  sure whether this means calling C++ from Pascal, or calling Pascal from C++.

I suspect it may be the first, whereas what would be required to reproduce something like the way C++ Builder interfaces with Delphi would be C+ calling Pascal.

I suspect that this may not necessarily be rocket science. It seems that gcc supports the construct

'extern pascal'

which enables a C++ program to call a program using Pascal rules. This is not an area I'm familiar with, but if I can make some time I might do a little tinkering with this.

Chris Gordon-Smith
London
Homepage: http://graffiti.virgin.net/c.gordon-smith/
Email Address: Please see my Home Page

Navigation

[0] Message Index

[#] Next page

Go to full version