473,666 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DLL Import Programatically ?

I know how to use [DLLImport] when I know the path the DLL I'll be
importing. But I have the following scenario:

I have a series of DLL plugins that all have the exact same function
signatures just different implementations of them.

I'd like to programatically search a directory for them and import them
some how. Even though I know there signatures at compile time I won't
know the DLL file names till run time.

Any ideas how to do this?

Thanks very much.

Nov 17 '05 #1
3 2266
You can do this in .NET 2.0. What you would do is create a delegate
with the appropriate signature. Once you have that, you would call
LoadLibrary and GetProcAddress (through the P/Invoke layer) to get the
address of the function.

Finally, you would call the static GetDelegateForF unctionPointer method
on the Marshal class to get a delegate that represents the function in the
unmanaged dll you loaded.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m

<wa********@yah oo.com> wrote in message
news:11******** **************@ f14g2000cwb.goo glegroups.com.. .
I know how to use [DLLImport] when I know the path the DLL I'll be
importing. But I have the following scenario:

I have a series of DLL plugins that all have the exact same function
signatures just different implementations of them.

I'd like to programatically search a directory for them and import them
some how. Even though I know there signatures at compile time I won't
know the DLL file names till run time.

Any ideas how to do this?

Thanks very much.

Nov 17 '05 #2
Nice, I'll look into that. Thanks very much for the info nick, I
appreciate it.

Nov 17 '05 #3
Tried your suggestion Nick and it works awesome. Thanks so much.

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
7035
by: google | last post by:
Is there anyway to programatically confirm that specific field names exist in the first row of a given Excel spreadsheet from code within Access? I have code set up to import data from our spreadsheets from HQ into our Access database for further use, using the first row as column headings to determine the destination field in the Access table. Since it's possible (and probable) that HQ could change the format of the spreadsheets without...
2
2330
by: john_aspinall | last post by:
For a kick off sorry if this is the wrong forum, Ill go on the Access one if Im not on the right board! Anyways, Ive got a problem and am not sure if its going to be solved programatically using ASP or not. Here's the overview: Im building an eCommerce web site using ASP. It has an Access DB at the back end. Im receiving the Product info from a series of CSV
0
1247
by: brian | last post by:
Hi there, I'm trying to figure out to to invoke the SqlServer 2005 Import/Export wizard programatically. I.e. Export DatabaseA.TableA to DatabaseB.TableA SqlBulkCopy seems nice but my destination table is not always SqlServer. I'm guessing I can use SSIS/DTS somehow?
0
1019
by: tapasi | last post by:
Hi, Can Anyone please tell me how to import 2000 database in vb.net 2003 by code. As well backup of sql server 2005 database in vb.net by code? Thanks in Advance.
0
8356
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8781
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8550
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7385
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6192
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5663
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4366
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2769
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.