views:

91

answers:

0

In C++/CLI the following is sample code that links native and managed code within the same file.

#include "stdafx.h"

#pragma unmanaged
__declspec( dllexport ) void func2()
{
    //native code goes here
}
#pragma managed

void func_clr()
{
    func2(); //managed code calls native
}

#pragma unmanaged
__declspec( dllexport ) void func()
{
    func_clr(); //native calls managed
}
#pragma managed

I am trying to experiment in getting other languages to link with managed code. I can compile other languages with the available tools and can compile CIL with ilasm. Ilasm produces the final .dll/.exe directly and I cant figure out a way to link in .obj files from other compilers.