Re: C++ to Delphi conversion
From: Rudy Velthuis (TeamB) (rvelthuis_at_gmx.de)
Date: 12/23/03
- Next message: Steve: "aborting a process"
- Previous message: valentin tihomirov: "Re: how to use "addr" function in asm?"
- In reply to: Oliver Young: "C++ to Delphi conversion"
- Next in thread: Martin Harvey (Demon Account): "Re: C++ to Delphi conversion"
- Reply: Martin Harvey (Demon Account): "Re: C++ to Delphi conversion"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 23 Dec 2003 04:40:13 -0700
Oliver Young wrote:
>
> > If the (C++) DLL allocated the memory
> > with 'new', then you must pass the (variable, char*) memory back
> > to the DLL so that it can call 'delete'. Delphi has no
> > 'delete' operator so it will not be able to free the
> > memory correctly.
>
> Is this truth? Delphi can't free char* (PCHAR) output pointer from
> function?
The DLL and the calling code don't use the same memory manager, so no, it
can't. In general, it is never very wise to return a newly created buffer
as a function result, unless you also provide a function to deallocate
the buffer.
But I would let the caller do the memory handling, and only let the
function fill or read the buffer.
-- Rudy Velthuis (TeamB) "The only thing necessary for the triumph of evil is for good men to do nothing." -- Edmund Burke (1729-1797)
- Next message: Steve: "aborting a process"
- Previous message: valentin tihomirov: "Re: how to use "addr" function in asm?"
- In reply to: Oliver Young: "C++ to Delphi conversion"
- Next in thread: Martin Harvey (Demon Account): "Re: C++ to Delphi conversion"
- Reply: Martin Harvey (Demon Account): "Re: C++ to Delphi conversion"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|