473,327 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Using a dotNET Class in C++

I have to write a dll that can be used by a legacy app. The legacy app looks
for a set of specific exported functions, with mangled names (in the form
_MyMangledFunction@nn). I really don't want (or need, or am able without
spending a lot of time) to write the whole thing in C.

It is my intention to provide the appropriate exports from a (MFC, or just
win32) C++ wrapper dll and from there pass everything straight through to
equivalent functions in a managed class in a managed DLL (VB or C#) which
will handle the logic.

1. I have written a test host app to emulate the legacy app that can call
_MyMangledGetNumber@0() in TestMFCDLL.dll
2. I have written a TestMFCDLL.dll in C++ (mix managed/unmanaged) that
exports MyMangledGetNumber() and returns a number to the test app.
3. I have written a TestVBDLL.dll class library defining a class called
MyManagedClass with a method GetNumber() that contains the logic I need.

The flow is this:
in host app (somewhere)
myIntegerVar = _MyMangledGetNumber@0() //from TestMFCDLL.dll

in TestMFCDLL.dll:
DWORD WINAPI MyMangledGetNumber()
{ //HOW DO I create an instance of TestVBDLL.MyManagedClass
//call to MyManagedClass.GetNumber() where logic resides
return MyManagedClass.GetNumber();
}

What I don't know how to do is the commented elements above. (The actual
scenario is - obviously - more complex than this, but this example
illustrates the essence of the problem). I am able to mix managed and
unmanaged code in TestMFCDLL.dll (safely), and am aware about ensuring it is
/NOENTRY etc.

Is this even a reasonable approach? Or can I create an appropriate .dll in
any dotnet language and export suitably mangled names some other way? I'm
looking, I suppose for both the quick, syntactic solution and broader views.
Nov 17 '05 #1
0 758

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

Similar topics

6
by: Billy Jacobs | last post by:
I have a website which has both secure and non-secure pages. I want to uses forms authentication. How do I accomplish this? Originally I had my web.config file in the root with Forms...
8
by: Dennis C. Drumm | last post by:
I have ordered the book .NET Framework Solutions, In Search of the Lost Win32 API by John Paul Meuller which I think will help answer some of my questions I have regarding making custom...
9
by: Guy | last post by:
I have extended the datetimepicker control to incorporate a ReadOnly property. I have used the new keyword to implement my own version of the value property, so that if readonly == true then it...
15
by: Nathan | last post by:
I have an aspx page with a data grid, some textboxes, and an update button. This page also has one html input element with type=file (not inside the data grid and runat=server). The update...
4
by: Jim Hammond | last post by:
It would be udeful to be able to get the current on-screen values from a FormView that is databound to an ObjectDataSource by using a callback instead of a postback. For example: public void...
8
by: Mike Owen | last post by:
Hi, I am trying to pre-compile a project prior using ASP.Net 2.0, VS 2005, to putting it onto a live server. The reason for doing this is that other people have access to the server, and I...
5
by: AliR | last post by:
Hi Everyone, I have a Visual C++ MFC program, and I am trying to use a webservice written in C#. When I add the webservice to my project using Add Web Reference the sproxy compiler complains...
2
by: Tim Reynolds | last post by:
Team, We need some guidance here. We are developing a web service to expose to external system. We are not sure which is the best path to take. We have multiple input fields required and a few...
2
by: Tugrul HELVACI | last post by:
I'm using Delphi 2006 and I have a class defination like this: TPerson = class fPersonName : String; fPersonSurName : String; fPersonAge : Integer; published property PersonName : String...
7
by: =?Utf-8?B?QU9UWCBTYW4gQW50b25pbw==?= | last post by:
Hi, I have been using the code (some of it has been removed for simplicity) below to allow authenticated (using ASP.NET membership database) users to get a file from their archive area. It...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.