473,785 Members | 2,395 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

accessing unmanaged C++ with VB or C#

We have an application completely written in C++ under visual studio v6. One
of our customers wants to use some of our existing components in his project
but doesn't know C++ and isn't interested in learning it. He does know C#
and VB though.

Whats the best option for us (ie. minimum work) to provide him with an API
that he can use in his own applications? I was originally considering a COM
interface, but looking into .NET, I'm wondering if we should just upgrade
the appropriate sections of code to "managed code" so he can use that from
one of his languages. Is this a big and difficult job in peoples experience?

Any advice is appreciated.

Thanks,
Brett.
Jul 21 '05 #1
2 1418
"Brett" <bg*****@hotmai l.com> wrote in message
news:IK******** ************@ad elphia.com...
We have an application completely written in C++ under visual studio v6. One of our customers wants to use some of our existing components in his project but doesn't know C++ and isn't interested in learning it. He does know C#
and VB though.

Whats the best option for us (ie. minimum work) to provide him with an API
that he can use in his own applications? I was originally considering a COM interface, but looking into .NET, I'm wondering if we should just upgrade
the appropriate sections of code to "managed code" so he can use that from
one of his languages. Is this a big and difficult job in peoples experience?
Any advice is appreciated.

Thanks,
Brett.


I should also mention that the C++ program has significant custom graphics
support and has a large set of classes that are capable of controling a USB
device. There is no web interface or anything required.
Jul 21 '05 #2
Brett wrote:
Whats the best option for us (ie. minimum work) to provide him with
an API that he can use in his own applications? I was originally
considering a COM interface, but looking into .NET, I'm wondering if
we should just upgrade the appropriate sections of code to "managed
code" so he can use that from one of his languages. Is this a big and
difficult job in peoples experience?


I assume you mean by using managed C++ to create wrapper classes. It's
not too difficult to do. Don't just compile your C++ with /clr because
that will make all the code compile to IL, except for code that won't
convert, in which case you'll have managed-unmanaged transitions. Its
better to compile your unmanaged code to a static lib, or a DLL and use
a simple wrapper class. That way you'll know that all of your library
will run as native code (as you intended and tested) and the
managed-unmanaged transitions will be where you expect them - in the
wrapper class.

Be aware of callback functions, because they will give another
managed-unmanaged transitions. You might want to pass large buffers into
your unmanaged code, in this case you can use the allocators in the
Marshal class; you could use .NET arrays, but in that case you'll have
to pin the array and that gets messy.

Richard
--
www.richardgrimes.com
my email ev******@zicf.b et is encrypted with ROT13 (www.rot13.org)
Jul 21 '05 #3

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

Similar topics

0
2338
by: Bruce Farmer | last post by:
I am having problems accessing a managed object from unmanaged code. Specifically, I have a .NET forms application with a web service proxy. The forms application links to an unmanaged DLL which uses callbacks to receive data via TCP. The data received in the callback must be passed to a web service via a web method provided by the proxy. So the callback (which is unmanaged code) needs to access the proxy (managed object) to send the...
2
2411
by: Brett Styles | last post by:
Hi Guys, I am trying to access a class in an unmanaged dll. I have created a wrapper managed class to access the functions I need but no matter what I try from the MSDN samples I can not get it to work with my code. I have a VB Net front end which need the access the unmanaged functions. The wrapper I wrote can be accessed but the wrapper will not compile when I refer to the unmanaged class. I have tried using header file for definitions...
4
1262
by: Bae,Hyun-jik | last post by:
Hi, What is the best case for accessing managed code from unmanaged C++ code, considering that the unmanaged code doesn't have managed extension? Please reply. Thanks in advance. Regards, Hyun-jik Bae
3
2038
by: Alex | last post by:
I'm having a problem porting an ASP solution to ASPX. In the ASP solution I'm accessing a DCOM server, create sub DCOM objects and call functions from VB script on the ASP pages. The DCOM object handles are stored in session variables. This works fine without a problem. Ported it to ASPX, accessing the same DCOM server from code behind pages. Still, usually no problems. However sometimes I'm seeing an error stating that the DCOM handle...
2
254
by: Brett | last post by:
We have an application completely written in C++ under visual studio v6. One of our customers wants to use some of our existing components in his project but doesn't know C++ and isn't interested in learning it. He does know C# and VB though. Whats the best option for us (ie. minimum work) to provide him with an API that he can use in his own applications? I was originally considering a COM interface, but looking into .NET, I'm wondering...
1
1445
by: Stephan Zaubzer | last post by:
Hi I relatively new to C# and at the moment I am having troubles accessing com objects within C#. I am working in VS.net. I add the com library I want to access to my references. Accessing classes exported in this com interfaces will throw a System.Security.SecurityException. (System.Security.Permissions.SecurityPermission) Status of failed permission: <IPermission class="System.Security.Permissions.SecurityPermission,
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
2466
by: omantawy | last post by:
Hi, I have some legacy ASP web applications that use an unmanaged COM component to connect to a third party application. The third part application has moved to the managed code in the current release with backward compatibility with the unmanaged code. In the future releases, the vendor is going to drop backward compatibility and as a result of that all our legacy ASP applications will break.
4
2073
by: Mau | last post by:
Hi, I have a managed dll which I am accessing from an unmanaged exe using Com Interop. I installed everything on computer 1 and run the unmanaged exe and from exe called my managed dll and everything works fine. Now from a second machine 2 on same network, I called this exe from Computer 1. Unmanaged exe run properly but when I called my managed dll, get error "OLE error 8013150A, ClassID: 4AD092B-26F2-4598-9B7B-A4654C9ACB76". But if I copy...
0
9647
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
9485
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
10161
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
10098
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
9958
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
8986
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
6743
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
5390
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...
1
4058
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 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.