Dealing with DllImport

DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: Dealing with DllImport

  1. #1
    Mark Hurd Guest

    Dealing with DllImport

    In the Dealing with DllImport article, Martin Heller mentions "we specified
    the ANSI form of the API function, so that it would work both on the Windows
    9x and NT families." without pointing out the power of the Auto option (Not
    sure of the C# specifics).

    Declare Auto Function GetPrivateProfileSectionNames ...

    will mean the runtime will check for the best available API when it is first
    used. (If you watch an API profiler as is part of the more recent versions of
    the "View Dependencies" tool, you see it checks for
    GetPrivateProfileSectionNames, GetPrivateProfileSectionNamesW and

    In the context of the article, there may be a need for an ANSI output, but
    that would have been better specified using a MarshalAs attribute.

    I'm quoting from

    Mark Hurd, B.Sc.(Ma.) (Hons.)\

  2. #2
    Mattias Sjögren Guest

    Re: Dealing with DllImport

    >I'm quoting from

    Terrible article. There were a number of other errors you could have
    mentioned in addition to this one.

    The author probably got some of his poor practices from Russel Jones'
    article, where many of the same mistakes are made (they didn't even
    get the title right).


    Mattias Sjögren (VB MVP)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center