473,765 Members | 2,024 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

C programming interface for .NET based Library

Hi All,
We have a .NET library having .NET remoting based programming interface
developed using VC++.NET (VS 2005 Beta2).

We want to provide C interface for a legacy application. Is it possible?
If yes, what would be the best approach?

Regards,
RS
Nov 17 '05 #1
3 1198
"Ratan" <Ra***@discussi ons.microsoft.c om> wrote in message
news:54******** *************** ***********@mic rosoft.com...
We have a .NET library having .NET remoting based programming interface
developed using VC++.NET (VS 2005 Beta2).

We want to provide C interface for a legacy application. Is it possible?
If yes, what would be the best approach?


You can use the assembly registration (regasm) utility

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

to "create" a COM object and type library from your .Net classes. Your C
application makes use of your .Net classes just as it would any other COM
object. I sketched the procedure with a toy .Net class and a C++ caller
here:

http://groups.google.com/group/micro...7cc21dc2b67f3d

If C++ rather than C is an option you can create an unmanaged C++ class (or
classes) which has one public method for every method of every class in your
..Net solution. Then the C++ application can use the "it just works" method
of interop

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

so that every call to one of these unmanaged methods is implemented by
calling on the corresponding managed method.

Regards.
Will
Nov 17 '05 #2
Hi Ratan!
We have a .NET library having .NET remoting based programming interface
developed using VC++.NET (VS 2005 Beta2).

We want to provide C interface for a legacy application. Is it possible?
If yes, what would be the best approach?


There are several ways to do this:
- COM-Interop (regasam as William said already)
- CLR-Hosting
- Managed C++ (if you write a DLL this might be possible; never tested
it...)

For more infos see:
http://www.gotdotnet.com/team/clr/wh...r_hosting.aspx
--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
Nov 17 '05 #3
Hi,

Thank you very much to *both of you* for your suggestion.
I will proceed according to your suggestions.

Regards,
RS

"Jochen Kalmbach [MVP]" wrote:
Hi Ratan!
We have a .NET library having .NET remoting based programming interface
developed using VC++.NET (VS 2005 Beta2).

We want to provide C interface for a legacy application. Is it possible?
If yes, what would be the best approach?


There are several ways to do this:
- COM-Interop (regasam as William said already)
- CLR-Hosting
- Managed C++ (if you write a DLL this might be possible; never tested
it...)

For more infos see:
http://www.gotdotnet.com/team/clr/wh...r_hosting.aspx
--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/

Nov 17 '05 #4

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

Similar topics

0
1291
by: Jesper | last post by:
I know that user interface library questions come up on this list every now and then. I've lurked here for a while and also searched google for anything that would fit my needs but haven't found anything. What I would like is a python library that exposes a simple API for creating a mostly dialog-based user interface. This library should work both on text and graphical terminals and be portable. The closest matches that I've found are:...
3
2378
by: Sai Kit Tong | last post by:
I posted for help on legacy code interface 2 days ago. Probably I didn't make it clear in my original mail. I got a couple of answers but none of them address my issues directly (See attached response). My first reply directed me to source code migration but I didn't have the source code. The second reply mentioned about .NET interoperability (PInvoke I think) but I MENTIONED THAT I COULDN'T FIND ANY DOCUMENTATION FROM MSDN LIBRARY BASED ON...
3
8217
by: Ohad Young | last post by:
Hi, I have an interface with an event. I'd like to explicitly implement the interface by a certain class. However, I received the following error: "An explicit interface implementation of an event must use property syntax" Here is a code sample: public interface IFoo
5
3183
by: Patrick Kristiansen | last post by:
Hi group! I've been reading Juval Löwys "Programming .NET Components", and I think it is a very good book, giving nice guidelines on how to really exhaust the possibilities of .NET in general. Juval Löwy is indeed an advocate of using interface-based programming (he wrote a chapter dedicated to it, and he's using it througout the book).
21
13846
by: Helge Jensen | last post by:
I've got some data that has Set structure, that is membership, insert and delete is fast (O(1), hashing). I can't find a System.Collections interface that matches the operations naturally offered by Sets. - ICollection cannot decide containment - IList promises indexability by the natural numbers, which is not achievable (since i hash elements, not sort them). - IDictionary is definatly not setlike. Although I can, of course, define...
6
1945
by: Ricky W. Hunt | last post by:
It's dawning on my a lot of my problems with VB.NET is I'm still approaching it in the same way I've programmed since the late 70's. I've always been very structured, flow-charted everything, used subroutines, etc. Now I'm trying to study this new way and I'm getting some terms confused and can find no clear definition (some even overlap or use two different words for the same thing, even when they are actually different). I'm reading a...
16
2225
by: Malcolm McLean | last post by:
I want this to be a serious, fruitful thread. Sabateurs will be plonked. Table-based programming is a new paradigm, similar to object-orientation, procedural decomposition, or functional programming. The idea is that all the data in the program comes in "tables". A table consists of records and fields, and is thus a 2d entry. Fields may be numbers or strings, and have names, descriptors, prevalidation conditions and postvalidation...
151
8101
by: istillshine | last post by:
There are many languages around: C++, JAVA, PASCAL, and so on. I tried to learn C++ and JAVA, but ended up criticizing them. Is it because C was my first programming language? I like C because, comparatively, it is small, efficient, and able to handle large and complex tasks. I could not understand why people are using and talking about other programming languages.
6
4884
by: John Ladasky | last post by:
Hi folks, I've played around with neural nets for a while. I wrote my own slow, pure-Python NN package. I knew that there were Python NN packages out there -- but I couldn't really understand their features and documentation at first, not without some hands-on experience. I haven't yet solved any interesting problems with NN, but I learned a lot about both NN and about Python along the way. One of the unpleasant things I learned...
0
9568
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
9399
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
10163
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
10007
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
9957
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
8832
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
7379
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
6649
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();...
2
3532
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.