473,326 Members | 2,090 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

multimodule assemblies and IJW/C++ Interop

I have a mixed DLL that "extends" an existing application and works just fine. It makes significant
use of IJW to interact with the native interfaces of the application that it is extending. I would
like to show that such application extensions can have parts authored in other .NET languages like
C#. So I set about rearranging my sample extension to become a multimodule assembly where one
..netmodule was authored in C# and another in MEC++ under VS 2003. And then I realized that I had no
idea how to really do this. My current mixed DLL uses a .def file and has some native .dll exports.
What do I do with them? Do I have to put the exported entry points into the module containing the
manifest (i.e. the assembly dll) ? Or can a native program do dynamic linking directly to a
mixed-mode .netmodule and have it work right?

Can anyone point me at an example that shows how to use create multi-language, multimodule
assemblies where some of the modules use IJW and have native exports?

Bern McCarty
Bentley Systems, Inc.
Nov 17 '05 #1
2 1863
Some follow up information. I moved my native entry points to the manifest-containing-module. So I
have a 3 file assembly: 1 .netmodule for C#, 1 .netmodule (but with a .dll extension) which
contains nearly all of the logic that is written in C++, and the assembly file itself which contains
the native .DLL exports. Modules 2 and 3 work around the CLR 1.1 "Mixed DLL loading problem" in the
normal way.

When I try to load this extension, it crashes the process. The host program is doing a LoadLibrary
on my main assembly file. The debugger seems generally erratic and untrustworthy while I've been
trying to figure this out, but I eventually managed to get this stack trace on the crash. Does
Module::BuildClassForModule simply NOT work for Mixed modules?
EEClass::NotifyDebuggerAttach() + 0x11 EEClass::NotifyDebuggerLoad() + 0x12
Module::BuildClassForModule() + 0x5da1b
Module::SetContainer() + 0x2daaf
Assembly::AddModule() + 0x139
BaseDomain::SetAssemblyManifestModule() + 0x20
BaseDomain::LoadAssembly() + 0x339
ExecuteDLL() + 0x7eee8
__CorDllMain@12() + 0x1c
_LdrpCallInitRoutine@16() + 0x14
_LdrpRunInitializeRoutines@4() + 0x32f
_LdrpLoadDll@24() + 0x372
_LdrLoadDll@16() + 0x1c5
_LoadLibraryExW@12() + 0xc8
_LoadLibraryExA@12() + 0x1d
_LoadLibraryA@4() + 0x2f

Bern McCarty
Bentley Systems, Inc.
"Bern McCarty" <be**********@bentley.com> wrote in message
news:uy*************@TK2MSFTNGP11.phx.gbl... I have a mixed DLL that "extends" an existing application and works just fine. It makes significant use of IJW to interact with the native interfaces of the application that it is extending. I would like to show that such application extensions can have parts authored in other .NET languages like
C#. So I set about rearranging my sample extension to become a multimodule assembly where one
.netmodule was authored in C# and another in MEC++ under VS 2003. And then I realized that I had no idea how to really do this. My current mixed DLL uses a .def file and has some native .dll exports. What do I do with them? Do I have to put the exported entry points into the module containing the
manifest (i.e. the assembly dll) ? Or can a native program do dynamic linking directly to a
mixed-mode .netmodule and have it work right?

Can anyone point me at an example that shows how to use create multi-language, multimodule
assemblies where some of the modules use IJW and have native exports?

Bern McCarty
Bentley Systems, Inc.

Nov 17 '05 #2
Hi Bern,

The issue here is C++ .netmodule already has C++ libs pulled in. This can
result in a conflict with libs pulled in by the linker for C++ .obj. To
avoid this, use .netmodule only for VB and C# project and link all you C++
code as obj/libs. Try to change your build setup and if you still see
runtime errors, feel free to contact me directly. I will help you to resolve
those.

Thanks,
--
Nikola Dudar
Visual C++; // Program Manager
This posting is provided "AS IS" with no warranties, and confers no rights.

"Bern McCarty" <be**********@bentley.com> wrote in message
news:%2******************@TK2MSFTNGP11.phx.gbl...
Some follow up information. I moved my native entry points to the
manifest-containing-module. So I
have a 3 file assembly: 1 .netmodule for C#, 1 .netmodule (but with a
.dll extension) which
contains nearly all of the logic that is written in C++, and the assembly
file itself which contains
the native .DLL exports. Modules 2 and 3 work around the CLR 1.1 "Mixed
DLL loading problem" in the
normal way.

When I try to load this extension, it crashes the process. The host
program is doing a LoadLibrary
on my main assembly file. The debugger seems generally erratic and
untrustworthy while I've been
trying to figure this out, but I eventually managed to get this stack
trace on the crash. Does
Module::BuildClassForModule simply NOT work for Mixed modules?
EEClass::NotifyDebuggerAttach() + 0x11

EEClass::NotifyDebuggerLoad() + 0x12
Module::BuildClassForModule() + 0x5da1b
Module::SetContainer() + 0x2daaf
Assembly::AddModule() + 0x139
BaseDomain::SetAssemblyManifestModule() + 0x20
BaseDomain::LoadAssembly() + 0x339
ExecuteDLL() + 0x7eee8
__CorDllMain@12() + 0x1c
_LdrpCallInitRoutine@16() + 0x14
_LdrpRunInitializeRoutines@4() + 0x32f
_LdrpLoadDll@24() + 0x372
_LdrLoadDll@16() + 0x1c5
_LoadLibraryExW@12() + 0xc8
_LoadLibraryExA@12() + 0x1d
_LoadLibraryA@4() + 0x2f

Bern McCarty
Bentley Systems, Inc.
"Bern McCarty" <be**********@bentley.com> wrote in message
news:uy*************@TK2MSFTNGP11.phx.gbl...
I have a mixed DLL that "extends" an existing application and works just
fine. It makes

significant
use of IJW to interact with the native interfaces of the application that
it is extending. I

would
like to show that such application extensions can have parts authored in
other .NET languages like
C#. So I set about rearranging my sample extension to become a
multimodule assembly where one
.netmodule was authored in C# and another in MEC++ under VS 2003. And
then I realized that I had

no
idea how to really do this. My current mixed DLL uses a .def file and
has some native .dll

exports.
What do I do with them? Do I have to put the exported entry points into
the module containing the
manifest (i.e. the assembly dll) ? Or can a native program do dynamic
linking directly to a
mixed-mode .netmodule and have it work right?

Can anyone point me at an example that shows how to use create
multi-language, multimodule
assemblies where some of the modules use IJW and have native exports?

Bern McCarty
Bentley Systems, Inc.


Nov 17 '05 #3

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

Similar topics

6
by: Binesh | last post by:
Hi I used Interop assemblies to read Excel data into DataSet. I am able to run it successfully on my workstation(windows XP and VS .Net 7 and MS Office XP) but when I port my code to...
6
by: cody | last post by:
What are multi file assemblies good for? What are the advantages of using multiple assemblies (A.DLL+B.DLL) vs. a single multi file assembly (A.DLL+A.NETMODULE)?
1
by: Afaq | last post by:
Hi, After adding large number of empty resource files (which will be updated later), we are not able to compile the project. the following is the output of the build process. It fails while...
4
by: J-T | last post by:
I'm trying to read an excell file in my .Net application using Office XP Primary Interop Assemblies (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoxpta/html/odc_oxppias.asp)....
2
by: Christopher H. Laco | last post by:
Long story longer, I'm tearing my hair out trying to get some of my assemblies to work in ASP/COM. I have 4 classes/assemblies: #1. CustomerMembershipProvider (Inherits MembershipProvider) #2. ...
7
by: R Reyes | last post by:
Can someone please explain to me why I can't get the MS Word Interop assembly to work in my VS2005 project? I'm trying to manipulate MS Word from my Web Form application and I can't get passed...
1
by: keanep | last post by:
Hi I'd appreciate some advice on how to access legacy C++/Win32 libraries from C#. We have a legacy Win32 application, mostly written in VC7.1, and we want to re-write the GUI and maybe some...
0
by: Tina | last post by:
I've gotten this before where it says there is a problem with Interop.MSDASC but I can't remember what causes this. This is a 1.1 app I'm trying to debug in vs2005. It was running yesterday just...
1
by: Armin Zingler | last post by:
Hi group, after waiting more than 4 month in the .upgrade group for an answer, I dare to ask here. :-) I open a VB6 project in VB 2008 (express) and have the Wizard convert it. It also...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.