[Lazarus] Lazarus-other list

Vincent Snijders vincent.snijders at gmail.com
Fri Jul 2 11:49:59 CEST 2010


On Thu, 2010-07-01 at 11:45
+0200,lazarus-request at lists.lazarus.freepascal.org wrote:

Hi,

> Message: 6
> Date: Thu, 01 Jul 2010 19:30:26 +0200
> From: Hans-Peter Diettrich <DrDiettrich1 at aol.com>
> Subject: Re: [Lazarus] Parser
> To: Lazarus mailing list <lazarus at lists.lazarus.freepascal.org>
> Message-ID: <4C2CD0B2.7060908 at aol.com>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
> 
> Florian Klaempfl schrieb:
> 
> >> A FP-propriety interface part would be added to the C units to make them
> >> create an FP compatible compiled unit, usable in the normal way by
> >> Pascal units and by the linker.
> > 
> > 
> > ... and not fully automatable, so not better than current solutions.
> > Even worse, it does not cover the cases which are really a problem like
> > 
> > #define CONFIGURE_THE_HEADER_IN_A_CERTAIN_WAY // simple example are the
> > UNICODE define in windows headers
> > #include <myheader.h>
> > 
> > Things like this are the really nasty corner cases which make h2pas only
> > semi automatic.
> 
> This is correct, and also is the most important reason for a tighter 
> integration of C source code into FPC projects.
> 
> > Show me a tool which translates C headers fully automatic in *usable*
> > pascal units (test case e.g. glibc and mysql), then we can continue this
> > discussion.
> 
> Just an idea:
> 
> The compiler can create the required (ppu?) files, when compiling a C 
> module. That file then perfectly reflects all the settings, that 
> affected the code generation of that module. Only this "header" version 
> is important for the use of that module, not any other 
> (mis-configurable) header files.
> 
> Likewise the compiler can use the information in the ppu file, instead 
> of those found in any #include file. There may exist some technical 
> problems with this solution, because C enforces no correspondence 
> between header and implementation files, neither by name nor content, 
> but I think that solutions can be found on a package base.
> 
> When a package contains a couple of C files, then a common package 
> header/ppu file could contain the descriptions of *all* items in that 
> package, and a list of related header files. Then the compiler can skip 
> over the listed #include files, and use the precise information in the 
> ppu file instead. This model only requires the construction of packages 
> for all used C files, and a one-time compilation of these packages, for 
> the construction of their ppu files. The compiler or a related tool can 
> create an dummy Pascal library unit for every such package, for easy 
> (human readable) use of the C packages in Pascal code.
> 
> DoDi

I have been trying to follow this discussion but didn't know what part
to quote.

I was under the possibly mistaken impression that Delphi allowed the
user to link in C/C++ code to a Delphi project. I have never done this.
I assumed that Lazarus could link in GNU C/C++ code. Is this, or ever
will it, be possible. What is stopping us from doing this?

I for one would like to open some of the Linux AisleRoit Solitaire C/C++
applications and try to run one or two of it's functions thru' a C/C++
converter then open the original C/C++ project and patch in Lazarus
code. I don't want to convert the entire C/C++ code to Lazarus cos this
would cause waves with the AisleRoit development team which are very pro
C/C++ but it would be nice to say "Hey, guys, have a look at this. It's
your own code with a Pascal/Lazarus patch which improves and enhances
the original game. How about making it your next version. See, you don't
even need to change your original C/C++ to Lazarus. All you need do is
install Lazarus and Bob's your Aunt Fanny... you've got Lazarus code
patched into C/C++ code and the best of both worlds."

You never know, this might open a whole new team of Linux developers
using and improving the Lazarus compiler.

My C/C++ skills are okay but very rusty. There is a good reason why I
don't like C/C++ and choose Pascal over it. I have done a few C/C++ to
Pascal/Delphi ports of Games; completely rewriting the code. 

I think that Pascal is more readable than C/C++ but also that the Linux
world is full of die-hard C/C++ programmers and it is our duty to show
that we can patch in Pascal code elegantly without needing to rewrite
all of their work.

Peter

-- 
Proudly developing Quality Cross Platform Open Source Games
Since 1970 with a Commodore PET 4016 with 16 KRAM
http://pews-freeware-games.org (<--- brand new -- still under development)





More information about the Lazarus mailing list