I have made a C++ DLL. Now I am calling it in my C# Code. I have written the following code:
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices; //For DllImport
namespace ExternCShar
{
class Program
{
[DllImport("MathFuncsDll.dll", CharSet = CharSet.Auto)]
public static extern double Add(double a, double b);
static void Main()
{
Console.WriteLine(Add(2.3, 4.5));
}
}
}
Now when I run this, the following error is generated:
Debug Error!
Program: ...
R6034
An application has made an attempt to load the C Runtime library without using a manifest.
This is an unsupported way to load Visual C++ DLLs. You need to modify your application to build with a manifest.
For more information, see the "Visual C++ Libraries as Shared Side-by-Side Assemblies" topic in the product documentation.
What should I do avoid this error?
Thanks.
Bina Khan.
|