473,770 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Accessing Existing Vc++ API from .NET C# or VC++.NET

Hi all,
I have doubt regarding .NET.
I have a tool which was developed on VC++ 6.0(Win32 Application ).
The application communicates with library (API) which was developed on
VC++ 6.0 called core client.
I am planning to develop the tool or Win32 application on .NET
platform and I dont' want to migrate the VC++ library (API) to .NET.
The new .NET tool should use the previous VC++ library API ( core
client ).
Is there any possibility to call VC++ 6.0 source file ( .CPP ) or
APIs from .NET ( C# or VC++.NET )..? IF so, would u please suggest me a
usefull link or tell me How can I do it. I dont' want to make the
existing VC++ core client into DLL and add it as a reference to .NET
project.

Thanks for you kindly help
Regards
Kiran

Nov 17 '05 #1
1 1459
<ve*********@gm ail.com> wrote in message
news:11******** *************@z 14g2000cwz.goog legroups.com...
I have doubt regarding .NET.
I have a tool which was developed on VC++ 6.0(Win32 Application ).
The application communicates with library (API) which was developed on
VC++ 6.0 called core client.
I am planning to develop the tool or Win32 application on .NET
platform and I dont' want to migrate the VC++ library (API) to .NET.
The new .NET tool should use the previous VC++ library API ( core
client ).
Is there any possibility to call VC++ 6.0 source file ( .CPP ) or
APIs from .NET ( C# or VC++.NET )..? IF so, would u please suggest me a
usefull link or tell me How can I do it. I dont' want to make the
existing VC++ core client into DLL and add it as a reference to .NET
project.


Well, IMO, the most straight-forward thing to do is to expose a DLL
interface to the library. That done, you can use the facility known as
Platform Invoke from C# as described here:

http://msdn.microsoft.com/library/de...ketutorial.asp

and here:

http://msdn.microsoft.com/library/de...forminvoke.asp

Alternatively you can use Managed C++ (or C++/CLI if you use VS.Net 2005 in
beta now) to create a managed class which can take advantage of what is
called "It just works" (aka IJW) which describes the ability of managed C++
to call unmanaged C++ almost by magic. No other .Net language lets you do
that. That done, your managed C++ class can be consumed by C# clients or
VB.Net clients or any other managed client.

There are issues, however, in developing mixed mode applications. See this
for the details:

http://msdn.microsoft.com/library/de...ingProblem.asp

Regards,
Will
Nov 17 '05 #2

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

Similar topics

5
6340
by: Maett | last post by:
Hi. When I try to compile this piece of Code with VC.NET 2003 // code start #include <vector> template< class T > struct Marker { public:
1
1468
by: Ken Allen | last post by:
We are attempting to replace one of our legacy services (developed in C++) with one that is developed as a C# service. The problem that I am encountering is dealing with the resources that are generated from the MSG file. These resources are used both by the existing service code (to format strings for internal use) and by the Event Viewer when entries are written to the Event Log to be associated with this source. 1. Can I access an...
4
5121
by: MSDousti | last post by:
Hi, everyone. I have written this code in Tubo C++ 3.0 earlier, and now I want to port it to VC.NET: int out=0; out=(out & 0xDF); outportb(0x378,out); .... As you see, it seeks to parallel port directly (port: 0x378)
2
3123
by: vemulakiran | last post by:
Hi all, I have doubt regarding .NET. I have a tool which was developed on VC++ 6.0(Win32 Application ). The application communicates with library (API) which was developed on VC++ 6.0 called core client. I am planning to develop the tool or Win32 application on .NET platform and I dont' want to migrate the VC++ library (API) to .NET. The new .NET tool should use the previous VC++ library API ( core client ). Is there any possibility to...
0
1060
by: Edward Diener | last post by:
Scenario: base class in one assembly, derived class in another assembly, __event in base class, testing if event has any handlers in derived class with 'if (OnTestEvent) { //etc. }'. Result: LINK : error LNK2020: unresolved token (0A000004) OnTestEvent LINK : fatal error LNK1120: 1 unresolved externals Reproduce:
0
286
by: wayne | last post by:
thanks Carl Daniel. :D Carl Daniel wrote: > *wayne wrote: > > Dear all, > > > > may i know how can i delete the contents of an existing file using > > vc++?? also, i would like to know how can i delete the whole file? >
1
2097
by: Rob C | last post by:
We have a client/server application that is written in VC++/MFC. We are trying to integrate with a 3rd party product that exposes its data through a web service. I am trying to figure out the best way to approach this. It seems like .NET provides the greatest support for accessing web services but I am not sure of the work involved in writing a .NET DLL to do this that Io can easily then call from my C++ code. i have been reading up on...
5
2404
by: Andy | last post by:
I'm having trouble accessing an unmanaged long from a managed class in VC++.NET When I do, the contents of the variable seem to be mangled. If I access the same variable byte-by-byte, I get the correct value. Regardless what I set the variable to, the value that is returned for a long is always the same value. What's going on...can anyone help me? A short version of the code follows:
1
1297
by: SUJIE | last post by:
Hi all, I have few header, obj and dlls of c++ program. Now i need to instantiate a class and access its objects. though i could include the header, i am not able to link to the dlls.. How do specify a link between obj,header and dll files. i dont have the source code.
0
9602
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
10237
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...
0
10071
jinu1996
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...
1
10017
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
9882
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
8905
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...
1
7431
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5326
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...
3
2832
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.