473,796 Members | 2,632 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1877
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::BuildCl assForModule simply NOT work for Mixed modules?
EEClass::Notify DebuggerAttach( ) + 0x11 EEClass::Notify DebuggerLoad() + 0x12
Module::BuildCl assForModule() + 0x5da1b
Module::SetCont ainer() + 0x2daaf
Assembly::AddMo dule() + 0x139
BaseDomain::Set AssemblyManifes tModule() + 0x20
BaseDomain::Loa dAssembly() + 0x339
ExecuteDLL() + 0x7eee8
__CorDllMain@12 () + 0x1c
_LdrpCallInitRo utine@16() + 0x14
_LdrpRunInitial izeRoutines@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**********@b entley.com> wrote in message
news:uy******** *****@TK2MSFTNG P11.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**********@b entley.com> wrote in message
news:%2******** **********@TK2M SFTNGP11.phx.gb l...
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::BuildCl assForModule simply NOT work for Mixed modules?
EEClass::Notify DebuggerAttach( ) + 0x11

EEClass::Notify DebuggerLoad() + 0x12
Module::BuildCl assForModule() + 0x5da1b
Module::SetCont ainer() + 0x2daaf
Assembly::AddMo dule() + 0x139
BaseDomain::Set AssemblyManifes tModule() + 0x20
BaseDomain::Loa dAssembly() + 0x339
ExecuteDLL() + 0x7eee8
__CorDllMain@12 () + 0x1c
_LdrpCallInitRo utine@16() + 0x14
_LdrpRunInitial izeRoutines@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**********@b entley.com> wrote in message
news:uy******** *****@TK2MSFTNG P11.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
6067
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 server(Windows 2000,.Net Framework 1.1,NO MS OFFICE) I get clsid not found. I believe this is because I do not have MS Office installed on my server( I might be wrong) 1. How do I get rid of this problem 2. If having strong names for the Interop assemblies...
6
8185
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
6936
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 compiling the Max.UI.Win project with the following error Satellite assemblies could not be built because the main project output is missing.
4
4074
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). I have installed Office 2003 on my developemnt box.Will my application be able to read all kinds of Excell file (97-2000-2003)? Dose the wrapper that .Net framework generates backward copatiable? Do I have to have the same version of Office...
2
3030
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. CustomTcpClient (Inherits TcpClient) #3. ASPFormsAuthentication (does magic to read/write FormsAuthenticationTickets in ASP 3.0) #4. ASPMembership (does magic to use Membership API within ASP 3.0) Now, all of these assemblies are set to...
7
10964
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 this screen below. Please help, thanks in advance... Configuration Error Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify...
1
1158
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 business components in C# (personally, I don't see the need,but the decision has been made). We still want to keep a sizeable part of the libraries and utilities as native Win32 libraries. can choose from. I'm thinking of proposing 2) for the...
0
2059
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 fine. Help! T Server Error in '/VT.Users' Application. -------------------------------------------------------------------------------- Configuration Error
1
1209
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 creates the necessary interop assemblies for the referenced ActiveX dlls. Problem: the interop assemblies are not imported the way they should. The
0
9685
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
9533
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
10461
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...
1
10190
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
10019
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
9057
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...
0
6796
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
5579
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.