Sign in Join

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

Mailing lists / lazarus / 2016-06

translation from c-header

3 messages · 3 people ·

Reply by email Subscribe to this list Your subscription

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

Koenraad Lelong

Hi,

I'm trying to port pigpio to fpc (http://abyz.co.uk/rpi/pigpio/). h2pas has a problem with this :
c : typedef void *(gpioThreadFunc_t) (void *);
How would this be translated to Pascal ?
I know it's a function without result (= procedure), but what about the paramater ?
Later that function/procedure is used like this :
function gpioStartThread(f:gpioThreadFunc_t;
userdata:pointer):Ppthread_t;cdecl;external;

I also have a doubt about this :

c : typedef void (*gpioTimerFunc_t)    (void);
Pascal : gpioTimerFunc_t = procedure (_para1:pointer);cdecl;

Is this OK ?

I'm not fluent with c, even less with such typedef's.

TIA,

Koenraad

Reply by email

Sven Barth
to Koenraad Lelong: I'm trying to port pigpio to fpc (http://abyz.co.uk/rpi/pigpio/). h2pas has a problem…
"Koenraad Lelong" wrote 8 lines
Hi, I'm trying to port pigpio to fpc (http://abyz.co.uk/rpi/pigpio/). h2pas has a problem with this : c : typedef void *(gpioThreadFunc_t) (void *); How would this be translated to Pascal ? I know it's a function without result (= procedure), but what about the

paramater ?

Later that function/procedure is used like this : function gpioStartThread(f:gpioThreadFunc_t;
userdata:pointer):Ppthread_t;cdecl;external;
Show quoted text 10 lines
I also have a doubt about this : c : typedef void (*gpioTimerFunc_t) (void); Pascal : gpioTimerFunc_t = procedure (_para1:pointer);cdecl; Is this OK ? I'm not fluent with c, even less with such typedef's.

Yes, that should be correct.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20160619/570e8c23/attachment.html>

Reply by email