artragis
artragis

Reputation: 3713

Link 1310 : error in VStudio 2010

I am developping a project under Visual Studio 2010 Ultimate Edition. When I pushed the "start debug" button, the compilation starts and gets an error

"Error Link 1310 : Exports not supported for pure. MSIL image in ...."

I don't know how to solve the issue, it seams to be a matter of option in compilation for Common Language Runtime, but I do not understand this part of the documentation http://msdn.microsoft.com/en-us/library/k8d11d4s%28v=vs.90%29.aspx .

Upvotes: 0

Views: 173

Answers (1)

Hans Passant
Hans Passant

Reputation: 942438

Well, change the option from /clr:pure to just plain /clr and it will stop complaining. Right-click your project, Properties, General, "Common Language Runtime support" setting.

The /clr:pure option forces the compiler to only omit IL, no machine code is permitted. You cannot export a function with that option, the compiler must emit a stub for the export that ensures that the CLR is loaded and that code transitions from native to managed execution. That stub requires machine code.

Whether that's what you really want is impossible to guess from the question. The /clr:pure option in general doesn't make a lot of sense, you might as well write the code in C# or VB.NET. The C++/CLI language is the weapon of choice if you need to interop with native code. The export stub is certainly nice, it saves you from having to host the CLR yourself or to get lost in COM programming. But beware that it is not especially quick.

Upvotes: 1

Related Questions