I need to dynamically load and call .NET assembly from native
application, written in C++.
I'm trying to do this by creating a (managed) module, written in C++/
CLI, whose header can be #included from native code like normal C++
header, and whose .cpp file uses C++/CLI to actually load and
call .NET assembly.
It kind of works right now, but not exactly how I want it to. Ideally,
I want to have something like a C++ wrapper class, which hides behing
its public interface all .NET stuff. In particular, I want the
lifetime of this wrapper to correspond to the time the .NET assembly
is loaded and accessible. The trouble is, a C++ class cannot contain
handles to any .NET objects. I cannot even create a global or static
handle. Right now evey time I need to call the assembly, I need to
load it. How to overcome this limitation?
I suspect I can wrap all .NET stuff in COM, but ideally I'd like to
stay away from (directly) calling COM and use C++/CLI instead. 1 5636
>The trouble is, a C++ class cannot contain handles to any .NET objects.
This is not true, you can search for "How to: Declare Handles in Native
Types" in MSDN.
--
Sheng Jiang
Microsoft MVP in VC++
<cc*******@gmai l.comwrote in message
news:11******** *************@i 13g2000prf.goog legroups.com...
I need to dynamically load and call .NET assembly from native
application, written in C++.
I'm trying to do this by creating a (managed) module, written in C++/
CLI, whose header can be #included from native code like normal C++
header, and whose .cpp file uses C++/CLI to actually load and
call .NET assembly.
It kind of works right now, but not exactly how I want it to. Ideally,
I want to have something like a C++ wrapper class, which hides behing
its public interface all .NET stuff. In particular, I want the
lifetime of this wrapper to correspond to the time the .NET assembly
is loaded and accessible. The trouble is, a C++ class cannot contain
handles to any .NET objects. I cannot even create a global or static
handle. Right now evey time I need to call the assembly, I need to
load it. How to overcome this limitation?
I suspect I can wrap all .NET stuff in COM, but ideally I'd like to
stay away from (directly) calling COM and use C++/CLI instead. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Jesper Nilsson |
last post by:
Hi,
I have imported my com dll with Visual studios "Add reference", and then i'm
using this code:
private static MyComDll connectionKit = new MyComDll();
public static void CreateBatch(object hBatch)
{ ...
connectionKit.ComCreateBatch(...)
|
by: Bern McCarty |
last post by:
I have run an experiment to try to learn some things about floating point
performance in managed C++. I am using Visual Studio
2003. I was hoping to get a feel for whether or not it would make sense to
punch out from managed code to native code (I was using
IJW) in order to do some amount of floating point work and, if so, what that
certain amount of floating point work was
approximately.
To attempt to do this I made a program that...
|
by: CharlesHenri |
last post by:
Hello,
i plan to use a managed dll containing WinForm classes in an unmanaged
win32 exe.
Starting from NOTHING, how do i have to proceed ?
I have found the following tutorial on microsoft.com :
"Converting Managed Extensions for C++ Projects from Pure Intermediate
|
by: Michael Hoehne |
last post by:
Hi,
I'm currently facing a problem with a mixed environment using .NET 1.1 and
..NET 2.0 web services.
We have a client application (the "client", system 1) running on .NET
2.0/WinXP, calling our web service (The "Web Service Server") running on a
separate machine (also .NET 2.0, Win2003 Server, system 2).
The web service server (system 2) itself makes calls to methods in the CRM
|
by: Reini |
last post by:
We are developing an Asp.Net 2.0 application (Web Administration) for the IIS
5.0 to 6.0 and the W2K to W2K3 operating system. The application consists of
several layers. One layer is a .Net 2.0 Classlibrary (DxuCoreClr.dll) written
in managed C++, that is encapsulating several native Api's in form of native
Win32 dlls (i.e. dxldaputils.dll). The Classlibrary and the native dlls are
installed to the bin directory of the Asp.Net 2.0...
| |
by: =?Utf-8?B?WUlndWNoaQ==?= |
last post by:
Hi All,
i wanted to know how can i use c++ developed in my c# code.
I want to use crypto++ library in my c# code. Any pointer would be helpful.
Regards,
Y Iguchi
|
by: Rudolf Meier |
last post by:
Hi
I try to build a C++/CLI DLL as a Wrapper for my C++ DLL... now, this works
more or less if I only have input-parameters... but I have a function like
this in native C++
void GetParams(BOOL* p_bool, int* p_int, wchar_t* p_str);
And those parameters are filled by this function (and yes, I know that the
buffer behind p_str has to be large enough to do this)... now, my problem
|
by: Ed |
last post by:
Hi, dear all,
I want to wrapper the legacy C++ Template Class to be used by the C#
code, so I try to wrapper the legacy C++ code into CLI/C++ code first.
One problem is how to wrapper C++ template class, such as List, Queue,
etc?
Here is a snippet of Native Code:
//Native code:
|
by: Vicent Giner |
last post by:
Hello.
I am new to Python. It seems a very interesting language to me. Its
simplicity is very attractive.
However, it is usually said that Python is not a compiled but
interpreted programming language —I mean, it is not like C, in that
sense.
I am working on my PhD Thesis, which is about Operations Research,
|
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...
|
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...
| |
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...
|
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,...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |