Re: C chars_ptr STORAGE_ERROR in Imported function



Niklas Holsti wrote:
....
I think it would be better to use the To_Chars_Ptr function, which makes a chars_ptr that points to Errbuf itself, without allocating another char_array, so there is no need to Free anything. This also needs a change in the declaration of Errbuf:

Errbuf : aliased Char_Array := (1 .. 256 => Interfaces.C.nul);

....
Errbuf_Ptr := To_Chars_Ptr (Errbuf'Unchecked_Access, False);

followed by:

Device := pcap_lookupdev(Errbuf_ptr);

....
HTH


This works like a charm, thanks a lot.

KRC
.