Ok, I added and referenced a C++ project in a C# solution, and it compiles fine, but when it tries to access the C++ code during runtime it says:
System.IO.FileLoadException was unhandled
Message="Attempt to load an unverifiable executable with fixups (IAT with more than 2 sections or a TLS section.) (Exception from HRESULT: 0x80131019)"
I tried putting the C# call in an 'unsafe' block but it made no difference. Any ideas as to where I'm being stupid? :p
The C# code is in a button click event:
Adder b;
int c = b.add1(5);
btnClick.Text = c.ToString();
C++ header:
#ifndef CALC_H
#define CALC_H
#pragma managed
public value class Adder
{
public:
int add1(int a);
};
#endif
C++ code:
#include "Calc.h"
#include <iostream>
#pragma managed
int Adder::add1(int a)
{
return a+1;
}
int Main()
{
return 0;
}