473,508 Members | 2,006 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Calling managed code

Hi,

I just created a solution that is based on unmanaged C++ code. Now, the .net
framework consists of some cool functions and classes - there is especially
one namespace I'd like to use.
That's why I'm currently trying to figure out what's the best way to use
this managed code snippet.
Is it possible to create a managed Dll (in any language, C#,VB,C.net) and
call this out of my unmanged C++ code?
If not, is it possible to create an old-style C++ dll (for calling
convention) and to insert some managed code (just like building a 'hybrid')?

Thanks for any help
Peter
Jul 21 '05 #1
2 1342
You can make a COM callable wrapper for your .Net code and compile it
do a .dll which you will call from your unmanaged code. Here is a link
that may help.

http://www.csharpfriends.com/Article...x?articleID=41

Jul 21 '05 #2
Peter Schmitz wrote:
Hi,

I just created a solution that is based on unmanaged C++ code. Now, the .net
framework consists of some cool functions and classes - there is especially
one namespace I'd like to use.
That's why I'm currently trying to figure out what's the best way to use
this managed code snippet.
Is it possible to create a managed Dll (in any language, C#,VB,C.net) and
call this out of my unmanged C++ code?
If not, is it possible to create an old-style C++ dll (for calling
convention) and to insert some managed code (just like building a 'hybrid')?

Thanks for any help
Peter


Yes, you can. However, I cannot confirm it is a safe method.

I have many cases which need to call Dotnet libraries from C/C++ native
code.

I will create a C/C++ DLL project in VS.NET and complie it with Assembly
Support (/clr).

The project exports native C DLL exported functions as normal.
However, in the functions, it calls to the Dotnet classes (e.g. in C#).

The C/C++ functions need to wrap any input/output parameters between
native and Dotnet datatype.
I still do not encounter any great problem by using this method.

--
Jacky Kwok
jacky@alumni_DOT_cuhk_DOT_edu_DOT_hk
jacky@compose_DOT_com_DOT_hk
Jul 21 '05 #3

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

Similar topics

2
408
by: b.bardugo | last post by:
Hi all, I have a C# user control (a little app I made to display video). In this code I am using a third party .dll, which is written in C++ (un-managed). I am tring to put this control on a web...
15
11727
by: Bryan | last post by:
I have a multi-threaded C# console application that uses WMI (System.Management namespace) to make RPC calls to several servers (600+ ) and returns ScheduledJobs. The section of my code that...
4
4336
by: zlatko | last post by:
Hello. I am new to .net . I have a managed C++ library. It looks like this. // header file namespace cppnetdll { public __gc class Class1 { public: static int foo_int(void);
5
1766
by: Virajitha Sarma | last post by:
Hi, Can u plz help me out with how to call a C# DLL from C... I tried to find out by searching in net..but i couldnot find anything on it.... Thanku Virajitha *** Sent via Developersdex...
1
2881
by: Jesse McGrew | last post by:
Hi all, I'm trying to make a plugin DLL for a third-party application, using VC++ .NET 2003. This DLL acts as a bridge between the C++ plugin API of the application, and my actual plugin code...
1
2581
by: H.B. | last post by:
Hi, I need to make a function that can display data on my Managed C++ app and be called by an unmanaged C++ DLL. Something like : void Form1::Form1_Load(System::Object * sender,...
1
3414
by: MC-Advantica | last post by:
Does anyone have a simple "Hello World" like application that demonstrates unmanaged C++ calling managed C++ developed in VS2005? I'm confused by many posts as they discuss managed extensions from...
11
3169
by: briankirkpatrick | last post by:
Forgive me if my post seems a little amateurish... I'm requesting assistance from some of you smart folks out there to get the managed calls write that meet the specification in the esa.h for...
3
4683
by: Klaus | last post by:
Hi, I have an existing VC 6 MFC application which communicates asynchronly with a VC 2005 managed code dll. I use an unmanaged base class with virtual functions to access methods in the MFC...
7
2663
by: =?Utf-8?B?UVNJRGV2ZWxvcGVy?= | last post by:
I have a C# logging assembly with a static constructor and methods that is called from another C# Assembly that is used as a COM interface for a VB6 Application. Ideally I need to build a file...
0
7226
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,...
0
7125
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...
0
7328
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,...
1
7049
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...
0
7499
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...
0
4709
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...
0
3199
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...
0
1561
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 ...
0
422
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...

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.