comp.lang.ada
 help / color / mirror / Atom feed
* C chars_ptr STORAGE_ERROR in Imported function
@ 2008-08-22  8:36 Kim Rostgaard Christensen
  2008-08-22  9:03 ` Niklas Holsti
  2008-08-22 18:48 ` anon
  0 siblings, 2 replies; 8+ messages in thread
From: Kim Rostgaard Christensen @ 2008-08-22  8:36 UTC (permalink / raw)


Hello there

I am in progress of binding the pcap c library to ada, it is a part of a
school project. And for that i need a funtion that modifies a parameter 
to a function like so:

char    *pcap_lookupdev(char *);

I have figured out this much:

  function pcap_lookupdev(errbuff : Interfaces.C.Strings.Chars_Ptr) 
return Interfaces.C.Strings.Chars_Ptr;
  pragma Import (C, pcap_lookupdev, "pcap_lookupdev");

This works in the sense that running it as root returns the device 
found, but when I run it as normal user I get

raised STORAGE_ERROR : stack overflow (or erroneous memory access)

Do I need to declare the buffer and then then pass its c pointer to the 
function?

It is declared like this in a c example:
char errbuf[PCAP_ERRBUF_SIZE];

Best
Kim Rostgaard Christensen



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

end of thread, other threads:[~2008-08-23 10:11 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-08-22  8:36 C chars_ptr STORAGE_ERROR in Imported function Kim Rostgaard Christensen
2008-08-22  9:03 ` Niklas Holsti
2008-08-22  9:55   ` Kim Rostgaard Christensen
2008-08-22 11:43     ` Niklas Holsti
2008-08-22 22:54       ` Kim Rostgaard Christensen
2008-08-22 18:48 ` anon
2008-08-22 21:55   ` tmoran
2008-08-23 10:11   ` Niklas Holsti

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