C chars_ptr STORAGE_ERROR in Imported function



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
.



Relevant Pages

  • Re: Question about OO programming in Ada
    ... when I declare a procedure ... Both the Ada Rationale and the Guide for C/C++ programmers say that you have ... The Ada 95 Reference says that the "all" attribute provides read-write ... Does that help to avoid casting as well? ...
    (comp.lang.ada)
  • Re: advice on package design
    ... > for following scope. ... the compiler would have to do ... the extra verbiage required just to declare X. ... Unfortunately this is also untrue in Ada. ...
    (comp.lang.ada)
  • Re: A novel design of linked lists
    ... Ada does not provide them. ... elements of a double-linked lists as OK, then we are on different pages. ... I don't see why it wouldn't be OK to declare ... this definitely applies to the dopes of String objects. ...
    (comp.lang.ada)
  • Re: A novel design of linked lists
    ... elements of a double-linked lists as OK, then we are on different pages. ... I don't see why it wouldn't be OK to declare ... pointers should be fully transparent in Ada. ... this definitely applies to the dopes of String objects. ...
    (comp.lang.ada)
  • Re: Instantiating private types with discriminants?
    ... Have I got to declare two new packages - one against ... is declared in the same package specification as T (same declarative ... Ada, you can also dispatch with plain variables, as illustrated above. ...
    (comp.lang.ada)