comp.lang.ada
 help / color / mirror / Atom feed
* A trouble with writing thick bindings
@ 2014-07-26 16:20 Victor Porton
  2014-07-27  9:52 ` AdaMagica
  0 siblings, 1 reply; 2+ messages in thread
From: Victor Porton @ 2014-07-26 16:20 UTC (permalink / raw)


Here is a simplified variation of a real problem.

Consider C definitions:

struct URL {
  /* ... */
};

struct Triple {
  struct URL *first, *second, *third;
};

I have created URI_Type Ada object which holds an access to "struct URL"; 
and frees it when an URI_Type object is finalized.

Now I've realized this does not work well with struct Triple. If I 
initialize an URI_Type object from say "second" pointer from that structure, 
then it could be freed twice: By the URI_Type finalization and by the C 
function (which may also be wrapped into finalization of an Ada object) 
which free pointers to triples.

What to do? Maybe create a base class which would not do finalization?

Real C code on which my simplified example is based:

http://librdf.org/raptor/api/raptor2-section-uri.html
http://librdf.org/raptor/api/raptor2-section-triples.html

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

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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-26 16:20 A trouble with writing thick bindings Victor Porton
2014-07-27  9:52 ` AdaMagica

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