Lisp HUG Maillist Archive

Macos opaque types

Apple does not always want developers to know what is behind a given  
type.
For example, in the coremidi framework the following type is defined.

typedef struct OpaqueMIDIClient * MIDIClientRef;

How does one write a foreign interface to this type definition?

Thanks

Bruno


Re: Macos opaque types

Unable to parse email body. Email id is 4038

Re: Macos opaque types

Very interesting !!!
I have applied this procedure before to framework header files but  
the only foreign types and function declaration that I was getting  
were number types.
However, when I remove form a framework header file all its comments  
the procedure works for all its content.
Has someone ever written a function to remove unnecessary content  
form a header file?
Is there a function call in the  foreign-parser package that would do  
the same job then using the Buffers>Evaluate menu with all the  
comments removed?

Thanks
Bruno

On Jun 17, 2005, at 10:33, Martin Simmons wrote:


>>>>>> On Fri, 17 Jun 2005 07:31:38 -0400, "Emond, Bruno"  
>>>>>> <bruno.emond@nrc-cnrc.gc.ca> said:
>>>>>>
>>>>>>
>
>   Bruce> Apple does not always want developers to know what is  
> behind a given
>   Bruce> type.
>   Bruce> For example, in the coremidi framework the following type  
> is defined.
>
>   Bruce> typedef struct OpaqueMIDIClient * MIDIClientRef;
>
>   Bruce> How does one write a foreign interface to this type  
> definition?
>
> You define a "forward reference" type for OpaqueMIDIClient.
>
> If you place the above decl in a buffer with a .h extension and  
> then do
> Evaluate Buffer in the Editor, LispWorks will generate something  
> like this:
>
> (fli:define-c-struct (opaquemidiclient
>                       (:foreign-name "OpaqueMIDIClient")
>                       (:forward-reference t)))
> (fli:define-c-typedef (midiclientref (:foreign-name "MIDIClientRef"))
>                       (:pointer (:struct opaquemidiclient)))
>
> I will get the documented for fli:define-c-struct updated to  
> mention this.
>
> -- 
> Martin Simmons                              Email:  
> martin@lispworks.com
> LispWorks Ltd, St John's Innovation Centre    TEL:   +44 1223 421860
> Cowley Road, Cambridge CB4 0WS, England.      FAX:   +44 870 2206189
>
>



Updated at: 2020-12-10 08:52 UTC