Re: Interfacing with C - pointer problem
- From: tmoran@xxxxxxx
- Date: Tue, 30 Jan 2007 15:10:53 -0600
type LPSTR is access all String;Because LPSTR points to a dynamic size string and thus needs to
This does not work correct. What I found is, that data'Address is 32
bit and LPSTR is 64 bit.
carry along bounds information. A C LPSTR does not point to a dynamic
string, but instead points to a single character - the first in the
string. So the match is
type LPSTR is access Interfaces.C.Char;
procedure C_Func (x : LPSTR); -- expects an address (C-pointer, 32-bit)
and then
data : Interfaces.C.char_array := Interfaces.C.To_C("ABC");
and
C_Func (data(data'first)'unchecked_access);
.
- Follow-Ups:
- Re: Interfacing with C - pointer problem
- From: Adam Beneschan
- Re: Interfacing with C - pointer problem
- References:
- Interfacing with C - pointer problem
- From: Gerd
- Interfacing with C - pointer problem
- Prev by Date: Re: Easy question about Character manipulation
- Next by Date: Re: Easy question about Character manipulation
- Previous by thread: Re: Interfacing with C - pointer problem
- Next by thread: Re: Interfacing with C - pointer problem
- Index(es):
Relevant Pages
|