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

Juha Manninen juha.manninen at phnet.fi
Tue Oct 6 10:25:46 CEST 2009


Hi,

Ok, I understand the situation.
I guess I am looking for a "perfect world" where you could choose your 
language more freely and still use all the great libraries out there.

I think support for GCC C++ libraries in FPC could be done with enough effort. 
It would be much more difficult than supporting cdecl or stdcall calling 
conventions for C libraries of course. Maybe it is not worth the effort.

Interesting things are happening in the interpreted / dynamic language world. 
For example the Parrot / Perl6 people realized that supporting many languages 
has no benefit unless they all can use the same libraries as well. And so, all 
languages run under Parrot really can use libraries written in any of the 
other supported languages.

http://www.parrot.org/languages

However, dynamic or interpreted languages have resource hungry virtual 
machines and so they are not suitable for all tasks, and I don't like bloated 
SW anyways...
I know that Java and such are fast nowadays with JIT compilers but the memory 
overhead is big and that is not about to change.

So, you want to use a compiled object oriented language, supported in many 
platforms and having decent libraries. What alternatives do you have? There is 
C++ and ...
what else... ?
ok, there is Free Pascal!

I have a soft spot for Object Pascal because of my use of Delphi. The language 
syntax is good now when generics were added. Few more improvements and it 
would be perfect.

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.


Juha Manninen


---

> I believe that using C++ objects directly is not very easy. I have found
> some time ago this site about how to do this in Delphi.
> 
> http://rvelthuis.de/articles/articles-cppobjs.html
> 
> However, Borland used to publish a C++ compiler at that time. And I
> believe that this solution is compiler dependant.
> 
> Overall, I think that wrapping the object into C function then in Free
> Pascal is the easy way. If C++ objects are really needed, I prefere to
> write a C++ procedure to perform everything that really needs this
> coding, then I wrap it in C and Free Pascal.
> 
> I hope I could help more.
> 
> Ciao,
> Gilles Marcou



More information about the fpc-pascal mailing list