[fpc-pascal] Re: Support for C++ library format?

Jonas Maebe jonas.maebe at elis.ugent.be
Tue Oct 6 10:48:58 CEST 2009


On 06 Oct 2009, at 10:25, Juha Manninen wrote:

> A common library format for compiled OO languages would be a real  
> improvement,
> competing directly with the development happening in dynamic /  
> interpreted
> languages.
>
> I guess I am not the first person to have this idea, but... wrote it  
> anyway.

This is the goal of the Microsoft CLI (Common Language  
Infrastructure). The library format in this case is an intermediate  
one rather than a native one (CIL, Common Intermediate Language), but  
it can be statically compiled into machine code afterwards. It also  
supports both dynamic languages (there are e.g. IronPython and  
IronRuby) and non-dynamic languages (C#, F#, C++, C, ...). It's also  
supposed to have explicit support for mixing different object models  
in a single program.

Borland/CodeGear tried to take advantage of this with Delphi .NET, but  
apparently weren't very successful with it (although that's probably  
in the eye of the beholder). I never looked into the details, so I  
don't know why.

Having a common API without an intermediate format would however be  
virtually impossible to design, especially if you want to guarantee  
backwards binary compatibility for all of the languages that you want  
to interoperate. You really need some kind of intermediate level with  
meta-information (higher level than the pure machine code) which  
describes what is a class, a method, inheritance trees, etc if you  
want to enable transparently mixing code coming from different  
languages/compilers.

Well, you could try to write something like http://sourceware.org/libffi/ 
  geared at different object models rather than at simply different  
ABIs, but I think it would be more fragile and it would offer less  
integration possibilities.


Jonas



More information about the fpc-pascal mailing list