Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Sep 3rd, 2004, 3:35 AM   #1
vbtoosharp
Newbie
 
Join Date: Aug 2004
Posts: 5
Rep Power: 0 vbtoosharp is on a distinguished road
I want to be able to load a known function from a DLL that is not know until run-time.

The program looks in a directory for DLLs and then loads them and calls a function common to all the dlls in that directory.

In C++ this is cake but I can’t find an equivalent for VB.NET anywhere.

below is some Pseudo code for those that don't know what i want to do.

typedef unsigned char* (__stdcall *Buffer)();
Buffer buf;
HINSTANCE LoadMe;
char* loc = "xbcdrc.dll"; //could do be any dll
LoadMe = LoadLibrary(loc);
buf = (Buffer)GetProcAddress(LoadMe, "GetBuffer");
vbtoosharp is offline   Reply With Quote
Old Sep 3rd, 2004, 5:01 PM   #2
kurifu
Expert Programmer
 
kurifu's Avatar
 
Join Date: Jul 2004
Location: Halifax, Nova Scotia (Canada)
Posts: 784
Rep Power: 5 kurifu is on a distinguished road
Send a message via ICQ to kurifu Send a message via MSN to kurifu
I do not think you can just load a library like that in .NET without using unmanaged code. Perhaps that is why you are gaving a hard time with VB.net, you may not be able to use umanaged code in VB.NET.

There are, however ways, of creating assemblies which will delegate functions in a DLL, look that up at http://www.thecodeproject.com -- there are a lot of articles up there on code delegates in .net.
__________________
Clifford Matthew Roche <geek@cliffordroche.com>
Web Hosting: http://www.crd-hosting.com
Consulting: http://www.crdev-consulting.com
kurifu is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 9:16 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC