Re: REPOST: Memory-allocation rules with Delphi .exe, C/C++ .dll?
From: Catherine Rees Lay (spamtrap_at_polyhedron.org.uk)
Date: 07/30/04
- Next message: Eric Fortier: "ShowModal with offset"
- Previous message: Markku Nevalainen: "Re: Epson Receipt Printer"
- In reply to: Elias Sabbagh: "REPOST: Memory-allocation rules with Delphi .exe, C/C++ .dll?"
- Next in thread: Elias Sabbagh: "Re: REPOST: Memory-allocation rules with Delphi .exe, C/C++ .dll?"
- Reply: Elias Sabbagh: "Re: REPOST: Memory-allocation rules with Delphi .exe, C/C++ .dll?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Fri, 30 Jul 2004 10:20:51 +0100
In article <b57fb7.0407291310.6b30568b@posting.google.com>, Elias
Sabbagh <ehs@sabbagh.com> writes
>Hi everyone--
>
>(reposting with what I hope is a clearer question...)
>
>Are either of these two scenarios forbidden?
>
>Scenario 1: Delphi .exe allocates mem (either SetLength() on dynamic
>array, or GetMem() on pointer). Passes it to routine found in a C/C++
>.dll (linked to using the cdecl calling convention). C/C++ .dll
>routine presumably stores pointer in a struct, occasionaly modifying
>values stored in the memory that the pointer points to. Later, Delphi
>.exe deallocates the mem (Finalize() or FreeMem()).
>
>Scenario 2: The opposite case -- C/C++ .dll provides specialty
>allocation routines, aglMalloc(), and aglFree(). Delphi .exe calls
>aglMalloc(), and keeps track of the Pointer that it returns. Delphi
>.exe modifies the memory through the use of a PSingle, an alias of
>Pointer. Later, Delphi calls aglFree() on the original Pointer.
>
>Thanks in advance,
>
>Elias Sabbagh
The only thing that would worry me is that the library bothered to
provide specialised allocation routines. Why? Is it possible that
something extra is being allocated and deallocated internally which
isn't visible to the caller? If so, scenario 1 will probably not work,
but scenario 2 should be OK.
Catherine.
-- Catherine Rees Lay To email me, use my first name in front of the "at".
- Next message: Eric Fortier: "ShowModal with offset"
- Previous message: Markku Nevalainen: "Re: Epson Receipt Printer"
- In reply to: Elias Sabbagh: "REPOST: Memory-allocation rules with Delphi .exe, C/C++ .dll?"
- Next in thread: Elias Sabbagh: "Re: REPOST: Memory-allocation rules with Delphi .exe, C/C++ .dll?"
- Reply: Elias Sabbagh: "Re: REPOST: Memory-allocation rules with Delphi .exe, C/C++ .dll?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|