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
    GetPrivateProfileSectionNamesA.)

    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
    http://www.devx.com/dotnet/articles/...mh062702-4.asp

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



  2. #2
    Mattias Sjögren Guest

    Re: Dealing with DllImport

    >I'm quoting from
    >http://www.devx.com/dotnet/articles/...mh062702-4.asp


    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).
    http://www.devx.com/dotnet/discussio...cominterop.asp


    Mattias

    ===
    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
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

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