Mixed assemblies and C#

U

Ubergeek

I recently came accross an article that stated that there were
unresolved issued with calling native (i.e. "unmanaged" C++) from
managed C++.

Does anyone know what the precise details of this issue is, and if there
have been any fixes/workarounds yet?. I am using C# (VC7.1) for my
frontend, but all my logic is tied up in Win32 C (and some C++) dlls.

If I understand the issue correctly, so long as I compile the native
C/C++ Dlls with VC6 (not VC7.1), I should not have an issue, and I will
be able to wrte managed C++ wrappers around my C/C++ API without any
problems - is this a correct assesment of the issue?
 
M

Mehdi

I recently came accross an article that stated that there were
unresolved issued with calling native (i.e. "unmanaged" C++) from
managed C++.

Does anyone know what the precise details of this issue is, and if there
have been any fixes/workarounds yet?. I am using C# (VC7.1) for my
frontend, but all my logic is tied up in Win32 C (and some C++) dlls.

This issue relates to DLL containing both native C++ code and managed C++
code. You can find all the details here:
http://msdn.microsoft.com/library/d...stechart/html/vcconMixedDLLLoadingProblem.asp

I don't know if this problem has been solved in .NET 2 but provided that
you are aware of it, the solution is relatively simple (and you don't
necessarily need to compile with VS 6). See the "Preparing with Current
Tools" section at the end of the article.
 
W

Willy Denoyette [MVP]

|I recently came accross an article that stated that there were
| unresolved issued with calling native (i.e. "unmanaged" C++) from
| managed C++.
|

Don't know what article you are refering to, but most of the issues with
mixed assemblies relate to the "OS loader lock" issue [1]. These issues are
taken care of in VC8.0 (vs2005).

[1]
http://msdn.microsoft.com/visualc/d...stechart/html/vcconMixedDLLLoadingProblem.asp

| Does anyone know what the precise details of this issue is, and if there
| have been any fixes/workarounds yet?. I am using C# (VC7.1) for my
| frontend, but all my logic is tied up in Win32 C (and some C++) dlls.
|

http://msdn.microsoft.com/visualc/default.aspx?pull=/library/en-us/dnvs05/html/debgb1ldlk.asp


| If I understand the issue correctly, so long as I compile the native
| C/C++ Dlls with VC6 (not VC7.1), I should not have an issue, and I will
| be able to wrte managed C++ wrappers around my C/C++ API without any
| problems - is this a correct assesment of the issue?

I see no reason why you should compile your native C++ code with VC6 and
your managed code with VC7.1, compile all your code using 7.1 (or better
8.0). Anyway, you should read the articles pointed to by the links in order
to understand what mixed mode DLL's and EXE's really are, but when using
VC7.1 to build your managed wrappers, you are almost certain to generate
mixed mode assemblies, so you need to know how to handle mixed mode issues
in managed C++, by reading this:
http://support.microsoft.com/?id=814472

Willy.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top