473,785 Members | 2,154 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 2785

"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
2202
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
4525
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
1999
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
1696
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
3278
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
1297
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
1434
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
3003
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
1720
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
9646
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
9484
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
10350
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
9957
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
8983
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
7505
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...
1
4055
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
2
3658
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2887
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.