comp.lang.ada
 help / color / mirror / Atom feed
From: Kim Rostgaard Christensen <krc@greenpc.dk>
Subject: C chars_ptr STORAGE_ERROR in Imported function
Date: Fri, 22 Aug 2008 10:36:38 +0200
Date: 2008-08-22T10:36:38+02:00	[thread overview]
Message-ID: <g8ltqo$7ir$1@jacob-sparre.dk> (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



             reply	other threads:[~2008-08-22  8:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-22  8:36 Kim Rostgaard Christensen [this message]
2008-08-22  9:03 ` C chars_ptr STORAGE_ERROR in Imported function 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
replies disabled

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