[m-users.] foreign_type confusion on how to do it across modules...

Julien Fischer jfischer at opturion.com
Sun Jul 14 17:10:03 AEST 2019


On Sat, 13 Jul 2019, emacstheviking wrote:

> In my sdl2.m module I have this code
>     % SDL_Rect
> :- type sdl_rect.
> :- pragma foreign_type("C", sdl_rect, "SDL_Rect", [can_pass_as_mercury_type]).
> The SDL_Rect structure is perfect enough and I don't want to define something like:
> 
> :- type sdl_rect ---> sdl_rect(x::int, y::int, w::int, h::int).

That's pretty much exactly what we did for rectangles in the Cairo
binding and it seems to work fine there.

Julien.


More information about the users mailing list