#include <Windows.h>
#include <MSCorEE.h>
#include <stdio.h>
void main(int argc, WCHAR **argv) {
ICLRRuntimeHost *pClrHost;
HRESULT hr = CorBindToRuntimeEx(
NULL, // desired CLR version (NULL=latest)
NULL, // desired GC flavor (NULL=workstation)
0, // desired startup flags
CLSID_CLRRuntimeHost, // CLSID of CLR
IID_ICLRRuntimeHost, // IID of ICLRRuntimeHost
(PVOID*) &pClrHost); // returned COM interface
pClrHost->Start();
DWORD retVal;
hr = pClrHost->ExecuteInDefaultAppDomain(
L"d:\NETASM\\gds.Common.dll",
L"gds.Common.NewTestClass", L"NewTestMethod", L"Load assembly complite", &retVal);
wprintf(L"Managed code returned %d", retVal);
}
using System;
namespace gds.Common {
public sealed class NewTestClass {
public static int NewTestMethod(String s) {
Console.WriteLine("Managed assembly: {0}", s);
return s.Length;
}
}
}
p/s/ почему то не работает дискриптор "src c"
Одна из основных проблем человека - проблема выбора.