[M3devel] open array parameter passing, to external C procedure

Daniel Alejandro Benavides D. dabenavidesd at yahoo.es
Mon Feb 6 17:06:24 CET 2012


Hi all:
given C no standard parameter by reference passing style, it should be not that easy. But how about WeakRef, where an open array of weak ref is easier to match with in Modula-3 words.
I don't know if Modula-3 has stronger types for that. Anyway, I don't know what kind of such struct is that either.
Thanks in advance

--- El lun, 6/2/12, Dragiša Durić <dragisha at m3w.org> escribió:

> De: Dragiša Durić <dragisha at m3w.org>
> Asunto: [M3devel] open array parameter passing, to external C procedure
> Para: "m3devel" <m3devel at elegosoft.com>
> Fecha: lunes, 6 de febrero, 2012 03:50
> I have this case:
> 
> extern int epoll_wait (int __epfd, struct epoll_event
> *__events,
>                
>        int __maxevents, int
> __timeout);
> 
> And I would like to do it like:
> 
> <*EXTERNAL*> 
> PROCEDURE epoll_wait (epfd: int; VAR events: ARRAY OF
> epoll_event; timeout: int := -1): int;
> 
>> VAR
>   events: ARRAY [0..MaxEvents-1] OF epoll_event;
> 
>> 
> WITH res = epoll_wait(epfd, events, 2) DO
>> END;
> 
> Can I expect cm3 to do "right thing". Or I have to place
> parameters "by hand" using ADR and SIZE?
> 
> TIA,
> dd
> 
> 



More information about the M3devel mailing list