473,834 Members | 2,319 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to use same filename DLLs in a Exe?(One is)

Everyone:
I want to use a DLL(FileName:Pu bFunction.Dll) built with VS.Net(C#) in a
unmanaged Program .But there was a Dll just has the same filename,it was
built with VC++(6.0).The unmanaged was loaded by LoadLibrary function
firstly,and it would be free until the Program's end.How can I Load the
managed Dll?
Nov 15 '05 #1
2 1797
Hi,

Firstly, you cannot have two files having the same name (probably only with
differences in character case) in the same folder (may be NTFS allows this
but FAT32 definitely not). Therefore, you will have to store these DLLs in
separate folders.

Secondly, while managed DLLs CAN be loaded with LoadLibrary, there is little
sense in doing so. The simplest way to expose a managed library to unmanaged
code is by making the managed library COM-visible.
Hence, the .NET Interop subsystem will take care of the DLL location - your
only responsibility would be to register the managed DLL with the
appropriate tool (regasm.exe). Provided it is stored in a separate folder,
this will ensure the framework will be able to successfully locate and load
the managed DLL.

Does this answer your question?

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"kinghuangz " <li*******@vip. sina.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Everyone:
I want to use a DLL(FileName:Pu bFunction.Dll) built with VS.Net(C#) in a unmanaged Program .But there was a Dll just has the same filename,it was
built with VC++(6.0).The unmanaged was loaded by LoadLibrary function
firstly,and it would be free until the Program's end.How can I Load the
managed Dll?


Nov 15 '05 #2
I called the Managed Dll successfully when the Managed Dlls and the
Unmanaged Dlls have not the same filename;
The method was introduced on
http://www.codeproject.com/dotnet/br...call%7Cmanaged.
The Dlls have the same filename in separate folders.It's impossible to
change the filename whether Managed Dll or
UnManaged Dll.

When run the program(unmanag ed),firstly,loa d the unmanaged file
'Pubfunction.dl l' by LoadLibrary;And when call the
function implement in managed Dll,I used a Bridge to call managed Dll.The
managed Project static reference the managed Dll named Pubfuncion.It will be
failed to load managed file Pubfunction.dll .The system first scan the
filelist which have been
Loaded.
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> дÈëÓÊ
¼þ news:OQ******** ******@TK2MSFTN GP10.phx.gbl...
Hi,

Firstly, you cannot have two files having the same name (probably only with differences in character case) in the same folder (may be NTFS allows this
but FAT32 definitely not). Therefore, you will have to store these DLLs in
separate folders.

Secondly, while managed DLLs CAN be loaded with LoadLibrary, there is little sense in doing so. The simplest way to expose a managed library to unmanaged code is by making the managed library COM-visible.
Hence, the .NET Interop subsystem will take care of the DLL location - your only responsibility would be to register the managed DLL with the
appropriate tool (regasm.exe). Provided it is stored in a separate folder,
this will ensure the framework will be able to successfully locate and load the managed DLL.

Does this answer your question?

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Test Studio
http://x-unity.miik.com.ua/teststudio.aspx
Bring the power of unit testing to VS .NET IDE

"kinghuangz " <li*******@vip. sina.com> wrote in message
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
Everyone:
I want to use a DLL(FileName:Pu bFunction.Dll) built with VS.Net(C#)
in a
unmanaged Program .But there was a Dll just has the same filename,it was
built with VC++(6.0).The unmanaged was loaded by LoadLibrary function
firstly,and it would be free until the Program's end.How can I Load the
managed Dll?

Nov 15 '05 #3

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

Similar topics

4
3060
by: John Hunter | last post by:
I am using distutils to build a python extension module on win32. I initialize the Extension class with a list of libraries with Extension("_gd", , include_dirs=incdirs, library_dirs=libdirs, libraries=libs, define_macros=macros)], and am using VC6++ where libs is a list . Distutils produces a link command with the required libraries as
3
1555
by: Sundararajan | last post by:
Dear Folks, Most documentation say that Assemblies are logical DLLs. really getting confused about the assemblies and DLLs. can any one of u help me to get a clear distinction between assemblies and DLLs. whts the demarcation line lying between the assemblies and DLLs Regards, -- S.Sundararajan
7
1989
by: richard pickworth | last post by:
when I try to run my app. on a different computer, I get an error, that DLLs are missing. How can I make my app. "stand alone"?. I am using VisC++ .Net Express. yours Richard
2
2865
by: Johann Blake | last post by:
I can hardly believe I'm the first one to report this, but having gone through the newsgroup, it appears that way. I would like to open a solution in the VS.NET IDE that consists of multiple DLLs and a test application (an .EXE). The .EXE is my startup application. All the DLLs are shared components. This means that they contain a key and are stored in the GAC. When I go to run the test application in the IDE, it will not execute...
0
1405
by: rob | last post by:
I have two projects (dlltest, dll2) both creating a dll. The two dlls define classes (dll1, dll2) within the same namespace (MyNamespace). One of the dlls (dlltest) is using functionality of the other dll (dll2). Also both dlls use the same enum (MyEnum) defined in a header file (common.h). This header file is included in both dlls. Now I have one function from the first dll (dlltest) return the return argument from the second dll...
0
3232
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs converted/developed with VB.NET. What I want from debugging is to be able to step into the methods in the DLLs called from ASP scripts using Visual Studio .NET. Background: For typical script debugging issues, you can read and follow the two documents on...
7
3113
by: Oenone | last post by:
I'm sure there's an obvious way to do this, but I'm missing it so far. I have an ASP.NET application that relies on several DLLs to work. Currently in order to get my site working I have to put them all in the bin/ folder within my web site's directory. As I have numerous web sites, I want to be able to place all of these DLLs just once into a single location elsewhere on the disk (e.g., "D:\DLLs"). I don't want to put them into the...
6
2209
by: Brian Bischof | last post by:
I'm having troubles getting the debugging process to work consistenly for external classes. I got it to work once and then I turned it off. But now I can't get re-enabled. Here is what I'm doing. If someone could tell me what I'm missing that would be great. 1. Create an external class and call it Test.dll. 2. Create a test Asp.net app called App.sln. 3. For App.sln I set a reference to Test.dll. 4. Compile App.sln and run it. The web...
10
1934
by: =?Utf-8?B?UmljaGFyZA==?= | last post by:
Hi, I usually deploy my ASP .NET application to the server by publishing, using Visual Studio 2005 publish feature. This creates the Bin folder on the server, with the compiled DLLs. I've been asked to publish by copying the files manually instead. I stopped IIS for the application, deleted the application files and subfolders from the server, copied the files and folders from my local PC's project,
0
10786
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10503
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
10544
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
9326
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
7754
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
5624
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
5790
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3973
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3079
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.