473,545 Members | 2,679 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Import a DLL at runtime

I need to import an unmanaged DLL (not COM or .NET, just a plain DLL), but
there's a caveat. I don't know its name at compile-time.

I know the functions and function signatures that are in it, but I can't
discover the name of the DLL until runtime. DLLImport, unless I'm
mistaken, can only be done at compile-time.

The question is, can I load the library at runtime with pure .NET code?

Thanks.
Nov 15 '05 #1
2 4735
David,

This isn't really possible in the current version of .NET. It might be
possible in the next release of .NET though.

You might want to look into using unmanaged code to expose this kind of
functionality, and then exposing that code to .NET somehow.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard. caspershouse.co m
"David Vestal" <so************ ****@mailcity.c om> wrote in message
news:Xn******** *************** ***********@130 .133.1.4...
I need to import an unmanaged DLL (not COM or .NET, just a plain DLL), but
there's a caveat. I don't know its name at compile-time.

I know the functions and function signatures that are in it, but I can't
discover the name of the DLL until runtime. DLLImport, unless I'm
mistaken, can only be done at compile-time.

The question is, can I load the library at runtime with pure .NET code?

Thanks.

Nov 15 '05 #2
David,

See if this helps

http://www.msjogren.net/dotnet/eng/s...dynpinvoke.asp

Mattias

--
Mattias Sjögren [MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.
Nov 15 '05 #3

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

Similar topics

5
14393
by: Ayesha Ahsan | last post by:
Hi, I use Runtime.getRuntime().exec(command) to make my system call. For Windows based Dos, i add "cmd /c" before I type in my system call. So for example make the system call "dir": String command="cmd /c dir"; Runtime.getRuntime().exec(command); What is the equivalenr of cmd /c in Unix .
2
8648
by: Dennis | last post by:
The setup: Windows XP Pro Python 2.3 GTK+ 2.2.1.2 and pyGTK 1.99.17 for Python 2.3 from http://www.pcpm.ucl.ac.be/~gustin/win32_ports/ I've downloaded and installed per the instructions the pyGTK and GTK+ for win32 from the above locations. Folowing the instructions, I import pygtk first, run pygtk.require('2.0') second and then import
1
2371
by: Andrew James | last post by:
All, I'm having some trouble with understanding python's importing behaviour in my application. I'm using psyco to optimise part of my code, but I'm not sure whether it inherits throughout the rest of my application (read this as for any imported module) if I import in in a 'higher-level' module. For example: A.py ====
5
1291
by: jon morgan | last post by:
Hi, I am trying to clean out all the VB specific code in a project before porting to C#. Having removed all the import references I still see the VB runtime is loaded at startup. How can I pin down what is actually causing the VB runtime still to load? Thanks for any help.
5
2022
by: Sharon Tal | last post by:
Compiler Error Message: CS0234: The type or namespace name 'Http' does not exist in the class or namespace 'System.Runtime.Remoting.Channels' (are you missing an assembly reference?) Source Error: Line 2: <%@ Import Namespace="System.Runtime.Remoting" %> Line 3: <%@ Import Namespace="System.Runtime.Remoting.Channels" %> Line 4: <%@...
6
2360
by: Bill Patel | last post by:
I am getting Runtime error on line 50. Please Help. Thank You Bill 1 <%@ Page Language="VB" %> 2 <%@ import Namespace="System.Data" %> 3 <%@ import Namespace="System.Data.SqlClient" %> 4 <script runat="server"> 5
23
6401
by: Shane Hathaway | last post by:
Here's a heretical idea. I'd like a way to import modules at the point where I need the functionality, rather than remember to import ahead of time. This might eliminate a step in my coding process. Currently, my process is I change code and later scan my changes to make matching changes to the import statements. The scan step is error...
0
1804
by: Terry Tang | last post by:
Hi There, We are extending Python interpreter to support special functions of our tools. What we did is to compile Python's source code (which is got from the an installation on a Linux environment for Python 2.3.3) and our extensions (C++ code) on Windows with Microsoft Visual C++ 6.0 compiler to generate the extended Python interpreter....
4
1608
by: surja | last post by:
Hi, I have written a code to download images from a server end desktop, but while running the code ,WTK is showing a runtime error " Create image from Byte array Uncaught exception java/lang/IllegalArgumentException: ". I cannot detect the necessary change I have to make to run my code succesfully.Please anyone can help me to solve this code...
20
3713
by: cowboyrocks2009 | last post by:
Hi, I need help to automate my code to take data from input file. Also I need to create it as a function so that I can pass it to some other program. I am new to Java so having a bit limitation to do this. My tab delimited Input File looks like this:- 21 p 13e 0 62 1 580001 andrew -14.53 -13.95 0 0 21 p 13d 63 124 580002 1160001 andrew...
0
7428
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...
0
7941
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...
1
7452
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...
0
7784
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5354
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...
0
3485
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...
1
1916
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
1
1039
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
738
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.