|
-
Nov 29th, 2005, 06:56 PM
#1
Thread Starter
Frenzied Member
"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?
-
Dec 1st, 2005, 06:44 AM
#2
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.
-
Dec 3rd, 2005, 03:52 AM
#3
Thread Starter
Frenzied Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|