comp.lang.ada
 help / color / mirror / Atom feed
* Binding a C function wit FILE* object
@ 2014-07-27 15:45 Victor Porton
  2014-07-27 16:34 ` Dan'l Miller
  0 siblings, 1 reply; 3+ messages in thread
From: Victor Porton @ 2014-07-27 15:45 UTC (permalink / raw)


I am writing thick bindings for Raptor C library.

What should I do regarding the following function?

int raptor_uri_print (const raptor_uri *uri, FILE *stream);

The trouble is that Ada probably has no interface with FILE* objects.

The simplest thing is just to omit binding this particular function 
altogether. Are there other variants?

-- 
Victor Porton - http://portonvictor.org


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Binding a C function wit FILE* object
  2014-07-27 15:45 Binding a C function wit FILE* object Victor Porton
@ 2014-07-27 16:34 ` Dan'l Miller
  2014-07-27 16:51   ` Victor Porton
  0 siblings, 1 reply; 3+ messages in thread
From: Dan'l Miller @ 2014-07-27 16:34 UTC (permalink / raw)


On Sunday, July 27, 2014 10:45:20 AM UTC-5, Victor Porton wrote:
> I am writing thick bindings for Raptor C library.

No, as multiple people keep implying or keep telling you overtly:  you are writing a thin binding.  If you are asking how to represent a pointer to FILE almost directly in Ada, then clearly you are writing a thin binding.  Perhaps a thin binding is best for what you envision, but be clear in your thinking what you are and what you are not doing.

> What should I do regarding the following function?
> int raptor_uri_print (const raptor_uri *uri, FILE *stream);
> The trouble is that Ada probably has no interface with FILE* objects.

In a thick binding, Ada would have its own first-class-citizen representation roughly analogous to FILE (not pointer to FILE), such as a tagged record for byte-streams in general from which each format of file is derived into subclasses.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Binding a C function wit FILE* object
  2014-07-27 16:34 ` Dan'l Miller
@ 2014-07-27 16:51   ` Victor Porton
  0 siblings, 0 replies; 3+ messages in thread
From: Victor Porton @ 2014-07-27 16:51 UTC (permalink / raw)


Dan'l Miller wrote:

> On Sunday, July 27, 2014 10:45:20 AM UTC-5, Victor Porton wrote:
>> I am writing thick bindings for Raptor C library.
> 
> No, as multiple people keep implying or keep telling you overtly:  you are
> writing a thin binding.  If you are asking how to represent a pointer to
> FILE almost directly in Ada, then clearly you are writing a thin binding. 
> Perhaps a thin binding is best for what you envision, but be clear in your
> thinking what you are and what you are not doing.
> 
>> What should I do regarding the following function?
>> int raptor_uri_print (const raptor_uri *uri, FILE *stream);
>> The trouble is that Ada probably has no interface with FILE* objects.
> 
> In a thick binding, Ada would have its own first-class-citizen
> representation roughly analogous to FILE (not pointer to FILE), such as a
> tagged record for byte-streams in general from which each format of file
> is derived into subclasses.

Most of my bindings are thick enough, but for this particular function I've 
made a thin binding (however it throws an exception instead of returning 
error value).

-- 
Victor Porton - http://portonvictor.org


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-07-27 16:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-27 15:45 Binding a C function wit FILE* object Victor Porton
2014-07-27 16:34 ` Dan'l Miller
2014-07-27 16:51   ` Victor Porton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox