Can we discuss this a little bit more?
Assuming I have a simple test class library with one class:
------
using System;
using System.Collections.Generic;
using System.Text;
namespace vc6interop
{
public class Interop
{
public static string GreetMe(string name)
{
return "Hallo " + name;
}
}
}
------
....that is compiled with "expose as COM" flag turned on.
What do I have to do in order to call this method in C++?
I found some code that would fit this sample but it gives me a lot of errors.
------
GreetMe function;
CString result;
HINSTANCE hinstLib = LoadLibrary("vc6interop.dll");
if (hinstLib) {
function = (GreetMe) GetProcAddress(hinstLib, "GreetMe");
if (function)
result = (function) ("John");
BOOL fFreeResult = FreeLibrary(hinstLib);
}
// Das Ergebnis anzeigen
if (!hinstLib || !function)
printf("Error\n");
else
printf("Result: %s\n", result);
------
"Bruno van Dooren" wrote:
2)build a .NET class library that communicates with your .NET app, and
register is for COM interop. then consume that COM class in your C++
application to work with the .NET application.
either way should work without too many problems.