My attemption with MS Visual Studio 2008 SP1.
Compilng/linking is OK. But the run of Main.exe results in FileNotFoundExc eption (HRESULT: 0x8007007E) in TestUnmanaged.M ain.
Main.exe runs successfully if four lines in Sub.cpp with "pragma" and "Dummy" are commented out and "cl /clr:safe /LN Sub.cpp" is applied.
Compilng/linking is OK. But the run of Main.exe results in FileNotFoundExc eption (HRESULT: 0x8007007E) in TestUnmanaged.M ain.
Code:
// cl /clr /LN Sub.cpp
using namespace System;
#pragma unmanaged
void Dummy () {;}
#pragma managed
namespace MySubSpace {
ref class Sub1 {
public:
void SaySub1 (String ^name) {
Console::WriteLine ("Sub1 says : {0}", name);
Dummy ();
}
};
}
// csc Main.cs /addmodule:Sub.netmodule /platform:x86
using System;
using MySubSpace;
public class TestUnmanaged {
public static void Main () {
Sub1 s1 = new Sub1();
s1.SaySub1 ("from Main");
}
}
Comment