// native.cpp : main project file.
// delegate to native function
// Calling the Dll (mydll.dll)
// compile with: /clr
#include "stdafx.h"

using namespace System;
using namespace System::Runtime::InteropServices;

delegate void Del(String ^s);

public ref class Test
{
	public:
		void delMember(String ^s)
		{
			Console::WriteLine(s);
		}
};

[DllImportAttribute("mydll.dll", CharSet=CharSet::Ansi)]
extern "C" void nativeFunction(Del ^d);

int main(array<System::String ^> ^args)
{
	Test ^MyTest = gcnew Test;
	Del ^d = gcnew Del(MyTest, &Test::delMember);
	nativeFunction(d);   // Call to native function
	return 0;
}
