[fpc-devel] ctypes and RTL

Marco van de Voort marcov at stack.nl
Mon Sep 15 13:13:50 CEST 2008


In our previous episode, Ivo Steinmann said:

> true, unixtype exports more than baseunix. in fact, unixtype exports the 
> content of ptypes.inc (platform dependant) in it's interface. most of 
> those types are reimported into interface part of baseunix and unix over 
> aliasptp.inc (platform independant).

And e.g. On FreeBSD sysctl imports unixtypes too, and baseunix imports
sysctl. IOW, you can't have sysctl import baseunix for the types.

> yes, ptypes.inc are included only by UnixType and the system unit, while 
> ctypes.inc is included by ptypes.inc. And that's exactly what I changed:
> 
> current situation:
> ctypes.inc: all c types
> aliasctp.inc: mapping of all ctypes defined in unixtype (over 
> ptypes.inc) to locale scope
> ptypes.inc: all unix platfrom (dependant) unix types. it also includes 
> ctypes.inc
> aliasptp.inc: mapping of all unix platfrom independant types + all 
> c-types defined in UnixType to locale scope
> unixtype: all unix platfrom (dpendant) unix types + all c-types
> baseunix: includes aliasptp.inc
> unix: includes aliasptp.inc
> 
> 1. I removed {$i ctypes.inc} from each ptypes.inc
> 2. I removed {$i aliasctp.inc} from ctypes.pp and aliasptp.inc and added 
> {$i ctypes.inc} instead
> 3. I added ctypes in uses clause of unixtype, baseunix and unix
> 4. I added ctypes.inc to system unit (because it's no longer included of 
> ptypes.inc)

(in the implemntation I hope)

> situation after changes:
> ctypes.inc: all c types
> aliasctp.inc: removed
> ctypes.pp: includes ctypes.inc
> unixtype: all unix platfrom (dependant) unix types

But unixtype and baseunix doesn't export the ctypes anymore, which breaks
compatibility.

A beginner program like

var c:cint;

begin
  <somebaseunixfunc>(c);

will nead adaptation. 




More information about the fpc-devel mailing list