Interfacing with C - pointer problem
- From: "Gerd" <GerdM.O@xxxxxxxxxxx>
- Date: 30 Jan 2007 06:23:37 -0800
I try to call some C code, so I wrote me a simple interface, but it
does not what I expected.
It looks like this:
type LPSTR is access all String;
procedure C_Func (x : LPSTR); -- expects an address (C-pointer, 32-
bit)
pragma Import (STDCALL, C_Func, "C_Func");
procedure Q is
data : aliased String := "ABC" & Ascii.Nul;
begin
C_Func (data'unchecked_access);
end Q;
This does not work correct. What I found is, that data'Address is 32
bit and LPSTR is 64 bit.
How to manage this?
I tried a "pragma Convention (C, LPSTR);" but this gives a warning. So
what would be the right way?
Thanks in advance,
Gerd
.
- Follow-Ups:
- Re: Interfacing with C - pointer problem
- From: tmoran
- Re: Interfacing with C - pointer problem
- From: Frank J. Lhota
- Re: Interfacing with C - pointer problem
- Prev by Date: Problems with gcov
- Next by Date: Re: Ravenscar - program termination
- Previous by thread: Problems with gcov
- Next by thread: Re: Interfacing with C - pointer problem
- Index(es):