Results 1 to 3 of 3

Thread: "explicit" linking of dll in vb.net

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,168

    "explicit" linking of dll in vb.net

    in c++, you do explicit linking by using loadlibrary and getprocaddress(). Can the same be done in vb.net? could I call dll functions the same way? other than using the code:

    public declare function dllfunction lib "mydll.dll" () as integer

    if so, how?

  2. #2
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: "explicit" linking of dll in vb.net

    For standard DLLs - you can still use LoadLibrary().

    Also, it is generally prefered to use the <DllImport> attribute rather than the Declare syntax. Declare is preserved for backwards compatibility while <DllImport> provides all the newer features of Platform Invoke in .NET.

    Unfortunately it is not possible (AFAIK) to use the pointer returned by GetProcaddress() to actually call the function. What you can do, is create a "halfway" DLL in C++ that actually calls the function for you.

    Or, you could use Reflection.Emit - as demonstrated (in the comments) here.

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Jul 2005
    Posts
    1,168

    Re: "explicit" linking of dll in vb.net

    what is this halfway you speak of?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width