Board index » delphi » Calling DLL's - Pointers to Pointers

Calling DLL's - Pointers to Pointers

I have a 'C' DLL function. It's being passed a pointer to a pointer from delphi.
As soon as the function tries to assign the pointer being pointed at to something
else, it bombs with an access violation. The same thing works okay from a 'C'
calling function.

 Any bits of wisdom out there?

     Greg

 

Re:Calling DLL's - Pointers to Pointers


Quote
Greg Pringle wrote:

> I have a 'C' DLL function. It's being passed a pointer to a pointer from delphi.
> As soon as the function tries to assign the pointer being pointed at to something
> else, it bombs with an access violation. The same thing works okay from a 'C'
> calling function.

>  Any bits of wisdom out there?

Yeah. Odds are your Pascal declaration in the import unit is wrong: Either you
munged the pointer to a pointer, or you forgot a "cdecl" or "stdcall" directive.

Why not post the C prototype, and then people can tell you what the Pascal should
be?

--

http://www.midnightbeach.com/jon   Personal Pages
http://www.midnightbeach.com/jon/pubs Programming Publications
http://www.midnightbeach.com/hs             Home School Resource List

Re:Calling DLL's - Pointers to Pointers


Quote
Greg Pringle <g...@htn.com> wrote:
>I have a 'C' DLL function. It's being passed a pointer to a pointer from delphi.
>As soon as the function tries to assign the pointer being pointed at to something
>else, it bombs with an access violation. The same thing works okay from a 'C'
>calling function.
> Any bits of wisdom out there?
>     Greg

Can you post the respective declarations? Have you switched to D2?
Is it a stdcall problem? Or is it a case of a missing/extra "var"
keyword in declaration, in possible combination with missing/extra
"^" in call?

Regards,
Bengt Richter

Other Threads