473,695 Members | 3,116 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Mixed DLL Loading Problem??

Hello,

I have a native DLL (written in C) which is supposed to call a managed DLL
(was written in C#, and an entry point was injected modifying the ildasm'd
code).

The exectuable calls the native DLL but the native DLL fails to load the
managed DLL. The paper that addresses the 'mixed DLL problem' below does not
offer any understandable workaround.
http://msdn.microsoft.com/library/de...ingProblem.asp

Does anybody who has came across this have a better understanding of the
possible resolutions of the mixed dll problem? I am very close to totally
abondaning working with mixed DLLs (wasting hundreds of manhours).

Regards,
Mali
Mar 7 '06 #1
3 2777

"Mali Guven" <gu*****@hotmai l.com> wrote in message
news:du******** **@eeyore.INS.c wru.edu...
| Hello,
|
| I have a native DLL (written in C) which is supposed to call a managed DLL
| (was written in C#, and an entry point was injected modifying the ildasm'd
| code).
|
| The exectuable calls the native DLL but the native DLL fails to load the
| managed DLL. The paper that addresses the 'mixed DLL problem' below does
not
| offer any understandable workaround.
|
http://msdn.microsoft.com/library/de...ingProblem.asp
|
| Does anybody who has came across this have a better understanding of the
| possible resolutions of the mixed dll problem? I am very close to totally
| abondaning working with mixed DLLs (wasting hundreds of manhours).
|
| Regards,
| Mali
|
|

If I understand you correctly, you are calling a managed function from pure
unmanaged C code, right?
If that's the case, this has nothing to do with the mixed mode issue, "mixed
mode" means a single DLL that contains both managed(IL) and native code. You
are calling an "entry point" in a C# managed assembly, that you have created
by tweaking the IL and re-assembling, I guess you know that this is not a
supported scenario and extremely error prone. All you can do is use a
supported interop mechanism, that is, a real "mixed mode DLL", that calls
into C#, without resorting to a dirty hack, or use COM interop.

Willy.
Mar 7 '06 #2

Thanks for the clarification. I will see what it would take to switch to the
real *mixed mode* (a DLL with both native and managed code). In my case, COM
interop is not an option due to speed concerns.

Mali
"Willy Denoyette [MVP]" <wi************ *@telenet.be> wrote in message
news:OX******** ******@TK2MSFTN GP14.phx.gbl...

"Mali Guven" <gu*****@hotmai l.com> wrote in message
news:du******** **@eeyore.INS.c wru.edu...
| Hello,
|
| I have a native DLL (written in C) which is supposed to call a managed DLL | (was written in C#, and an entry point was injected modifying the ildasm'd | code).
|
| The exectuable calls the native DLL but the native DLL fails to load the
| managed DLL. The paper that addresses the 'mixed DLL problem' below does
not
| offer any understandable workaround.
|
http://msdn.microsoft.com/library/de...ingProblem.asp |
| Does anybody who has came across this have a better understanding of the
| possible resolutions of the mixed dll problem? I am very close to totally | abondaning working with mixed DLLs (wasting hundreds of manhours).
|
| Regards,
| Mali
|
|

If I understand you correctly, you are calling a managed function from pure unmanaged C code, right?
If that's the case, this has nothing to do with the mixed mode issue, "mixed mode" means a single DLL that contains both managed(IL) and native code. You are calling an "entry point" in a C# managed assembly, that you have created by tweaking the IL and re-assembling, I guess you know that this is not a
supported scenario and extremely error prone. All you can do is use a
supported interop mechanism, that is, a real "mixed mode DLL", that calls
into C#, without resorting to a dirty hack, or use COM interop.

Willy.

Mar 7 '06 #3
Speed should not be a concern, COM interop can just be as fast as any other
interop mechanism (when done correctly). Whenever you transition from
unmanaged to unmanaged and back you'll incur some overhead, if this is not
wanted, you should not use managed code (or unmanaged for that matter).

Willy.
"Mali Guven" <gu*****@hotmai l.com> wrote in message
news:du******** **@eeyore.INS.c wru.edu...
|
| Thanks for the clarification. I will see what it would take to switch to
the
| real *mixed mode* (a DLL with both native and managed code). In my case,
COM
| interop is not an option due to speed concerns.
|
| Mali
|
|
| "Willy Denoyette [MVP]" <wi************ *@telenet.be> wrote in message
| news:OX******** ******@TK2MSFTN GP14.phx.gbl...
| >
| > "Mali Guven" <gu*****@hotmai l.com> wrote in message
| > news:du******** **@eeyore.INS.c wru.edu...
| > | Hello,
| > |
| > | I have a native DLL (written in C) which is supposed to call a managed
| DLL
| > | (was written in C#, and an entry point was injected modifying the
| ildasm'd
| > | code).
| > |
| > | The exectuable calls the native DLL but the native DLL fails to load
the
| > | managed DLL. The paper that addresses the 'mixed DLL problem' below
does
| > not
| > | offer any understandable workaround.
| > |
| >
|
http://msdn.microsoft.com/library/de...ingProblem.asp
| > |
| > | Does anybody who has came across this have a better understanding of
the
| > | possible resolutions of the mixed dll problem? I am very close to
| totally
| > | abondaning working with mixed DLLs (wasting hundreds of manhours).
| > |
| > | Regards,
| > | Mali
| > |
| > |
| >
| > If I understand you correctly, you are calling a managed function from
| pure
| > unmanaged C code, right?
| > If that's the case, this has nothing to do with the mixed mode issue,
| "mixed
| > mode" means a single DLL that contains both managed(IL) and native code.
| You
| > are calling an "entry point" in a C# managed assembly, that you have
| created
| > by tweaking the IL and re-assembling, I guess you know that this is not
a
| > supported scenario and extremely error prone. All you can do is use a
| > supported interop mechanism, that is, a real "mixed mode DLL", that
calls
| > into C#, without resorting to a dirty hack, or use COM interop.
| >
| > Willy.
| >
| >
|
|
Mar 7 '06 #4

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

Similar topics

1
2196
by: Mike Kamzyuk | last post by:
Hello all. Basically, I need to call a mixed-mode dll's function (which uses managed code) from a native or mixed-mode dll function (which does not use managed code). I'm wondering if this could be accomplished and how. Here's the problem. We have a third party app (TPA) capable of loading native and mixed-mode dlls somehow (we don't know how). It loads our native dll (OND) and allows us to use our code inside the app (that is, we...
8
4514
by: Ted Miller | last post by:
Hi folks, I'm looking at moving a large base of C++ code to .Net under tight time constraints. The code runs in mission-critical environments, and I am extremely concerned about the loader lock problem and the potential for deadlocks. After pouring over the available information, and trying a few experiments, I am still left with a few questions and issues I hope someone out there can shed some light on.
8
1995
by: Nadav | last post by:
Hi, I am writing a performence critical application, this require me to stick to unmanaged C++ as performance is much better using unmanaged C++ ( about 33% better ), Still, I am trying to avoid the usage of old style COM, my alternative is to expose my unmanaged interface through the CLI, to achieve that I have created a mixed mode DLL in which my unmanaged class are defined. When referencing the DLL just described in another mixed mode EXE...
7
1690
by: Staale L. Hansen | last post by:
We have an application which uses some mixed-mode code to expose a .NET 1.1 managed API. Only the necessary files are compiled with /clr. We want to be able to load the application without .NET present, and then just disable the API. But we are not even able to give an error message when we start the application without mscoree.dll present. We have tried delay-loading mscoree.dll, but that did not help because the OS loader (at least on...
5
3274
by: bonk | last post by:
I have a plain unmanaged exe (no /CLR) that is supposed to to use classes from a mixed mode dll (dll that uses .NET internally). That dll only needs to expose unmanaged interfaces (classes and/or functions). This is of course no problem and it works fine. However I have the special scenario where the exe needs to be able to run even when there is no .NET Framework installed. The exe is supposed to check at runtime if the .NET Framework is...
0
1294
by: AG | last post by:
Hi, I have implemented the ASP.Net Ihttphandler interface. Handler references the mixed dll (both managed/unmanaged code) that contains core C++ classes wrapped under managed c++ wrappers. ASP.NET worker process, sometimes while loading the handler and mixed dll associated with it, throws System::DLLNotFoundException. I have verified that all required Dlls are in the system path. I have the handler version up and running perfectly but...
7
1425
by: Kevin Frey | last post by:
Using .NET 1.1. We have a mixed-mode assembly written in Managed C++ that we are using from an ASP.NET application that has been coded using C#. The mixed-mode assembly has its own "initialisation" routine to cater for any potential "mixed-mode DLL loading problem". Some of our code uses thread-local-storage, and in the DllMain for my mixed-mode assembly I did the appropriate initialisation of the thread-local-storage object on...
0
2998
by: emu | last post by:
Hi All, I have an unmanaged C++ application that references a mixed mode image DLL (mixed managed and unmanaged). Under .NET 1.1 we could trust the dll (the mixed mode dll) by running the following command line: caspol.exe -polchgprompt off -machine -addgroup 1 -url "file://<UNC path to dll>\mixedMode.dll" FullTrust ame "GroupName" -polchgprompt on
1
1718
by: aircraft | last post by:
Hi folks, I'm trying to load a mixed mode dll from a native c++ application using loadLibrary. If I run the application from the local drive it works without any problem, byt il I run it from the network it crashes at the moment of loading the mixed mode dll with a System.IO.LoadFileException. I know that the problem comes from the code access security policy and that's not my question :) In fact as I know it's not possible to catch...
0
8640
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, weíll explore What is ONU, What Is Router, ONU & Routerís main usage, and What is the difference between ONU and Router. Letís take a closer look ! Part I. Meaning of...
0
8582
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
9122
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
9001
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...
0
8832
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5841
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
4348
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
4587
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
1984
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.