Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2008-12

Porting discussion

4 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Rainer Stratmann

To increaase compatibility to Linux it would be great if it is possible to create a keyword which it makes possible to include C-headers and then do automatically the binding stuff.

That means that fpc woul be able to parse C-code (headers).

If that is possible.

Marco van de Voort
to Rainer Stratmann

In our previous episode, Rainer Stratmann said:

Show quoted text 7 lines
To increaase compatibility to Linux it would be great if it is possible to create a keyword which it makes possible to include C-headers and then do automatically the binding stuff. That means that fpc woul be able to parse C-code (headers). If that is possible.

Not, or at least not enough to be robust. A lot of C headers is based on (macro,define) substitution, IOW it needs context of use to obtain the full meaning.

This is also why the header conversion tool only works to a certain degree. If headers are reasonably clean it can work ok. If you have hundreds of macros and special constructs it needs manual work. (for which I can't imagine a solution, even in theory).

Rainer Stratmann
to Marco van de Voort
Marco van de Voort wrote 17 lines
In our previous episode, Rainer Stratmann said: > To increaase compatibility to Linux it would be great if it is possible > to create a keyword which it makes possible to include C-headers and then > do automatically the binding stuff. > > That means that fpc woul be able to parse C-code (headers). > > If that is possible. Not, or at least not enough to be robust. A lot of C headers is based on (macro,define) substitution, IOW it needs context of use to obtain the full meaning. This is also why the header conversion tool only works to a certain degree. If headers are reasonably clean it can work ok. If you have hundreds of macros and special constructs it needs manual work. (for which I can't imagine a solution, even in theory).

May it would be a solution if the C-compiler which compiles the library generates a 'generic library interface file' or something similar with all necessary information. Because the compiler has all the information.

From this 'generic library interface file' it will be easier to convert a pascal header interface file. Or the C-compiler generates it directly for pascal. ---> 'pascal library interface file' or similar...

That I can imagine could be a solution, but the C-compiler programmers have to implement this function.

The full meaning-context can be read in the original C-header file then.

_______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal