comp.lang.ada
 help / color / mirror / Atom feed
* Allocating a C string without heap
@ 2014-07-26 16:01 Victor Porton
  2014-07-26 16:20 ` Dmitry A. Kazakov
  0 siblings, 1 reply; 4+ messages in thread
From: Victor Porton @ 2014-07-26 16:01 UTC (permalink / raw)


Let we have an Ada String.

I need to pass it converted to a C string into a C library function.

Now I do it with Interfaces.C.Strings.New_String. But it is slow as it uses 
the heap and requires (not to forget incidentally!) further 
Interfaces.C.Strings.Free.

Is there a better way to do this? I mean that we would probably create a 
nul-terminated char_array (not on the heap but on the stack!) and pass the 
pointer to its first element.

This would be both safer an faster.

Can you elaborate on this?

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

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

end of thread, other threads:[~2014-07-26 18:38 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-26 16:01 Allocating a C string without heap Victor Porton
2014-07-26 16:20 ` Dmitry A. Kazakov
2014-07-26 16:30   ` Victor Porton
2014-07-26 18:38     ` Dmitry A. Kazakov

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