Re: So Delphi can't do this ...

From: Rob Kennedy (.)
Date: 10/12/03


Date: Sun, 12 Oct 2003 16:23:24 -0500

Martin Harvey (Demon Account) wrote:
> Hang on - isn't this back to front?
>
> If the structure is declared as exportable from the DLL, then he
> doesn't want to define some memory that he can export as a function,
> he wants to read and write it, having imported it from the DLL

No. Microsoft Flight Simulator is the program that's importing things.
Paul's writing an add-on for FS, and FS expects to be able to import a
structure, not a function.

Since Delphi only exports functions, Brian wrote a function that takes
up the same amount of space as a record would. Since FS needs to be able
to write to that space, he also includes code to make that region of
memory writeable.

For the particular DLL at hand, I suspect this solution will work fine,
but I worry about it as a general solution for exporting data. If there
were multiple processes linking to this DLL, I think they would all get
pointers to the same region of memory rather than each getting its own
separate copy. I wonder whether how it works when exporting data in the
conventional C and C++ way.

> In which case, it's just a matter of casing the return value of
> GetProcAddress right?

Given your (incorrect) premise, I believe your conclusion is correct.

-- 
Rob


Relevant Pages

  • Re: Need help in exporting API for Kernel Mode DLL to Application
    ... I am facing some problem in exporting kernel mode Driver DLL API to ... When this MYDTest is called in application, ...
    (microsoft.public.windowsce.platbuilder)
  • Re: VC++ .NET 2002: Which Wizard/Template to Use to Get a Regular DLL and a non-MFC DLL of native C+
    ... Prior to this use such DLL file must be loaded into memory by host ... make your DLL usable from other compilers or other programming ... "Managed C++" above - as those are NOT plain dynamic libraries! ... entities you are exporting from your DLL library. ...
    (microsoft.public.dotnet.languages.vc)
  • Re: Exporting classes; good idea, bad idea, and problems?
    ... I wrote an "engine" while I was working towards my MS in Comp.Sci and pretty ... I've decided that I whould like to make the Engine library into a DLL ... > Since the implementation is available in the client app because the client ... > If exporting the classes is not feasible, ...
    (microsoft.public.vc.language)
  • Re: Show Dialog from MFC Extension DLL
    ... and used by both MFC applications as well as non-MFC applications. ... I simplify things by exporting a non-MFC class that "represents" my dialog. ... file that has no MFC in it, so they aren't exposed to it (this is what allows ATL and console applications to use the DLL to show the dialog). ...
    (microsoft.public.vc.mfc)
  • Re: Why do we need executables in certain formats ?
    ... > complex binary formats was that programs need to be relocated, ... > perhaps linked with libraries. ... Modern virtual memory processors can locate to ... > has a hidden problem with the new .DLL. ...
    (comp.lang.asm.x86)