Здравствуйте!
Помогите разобратся со следующим:
Пробую вызвать внешнюю функцию, ее исходний код:
__declspec( dllexport ) int MyFunction(int MyVal)
{
return MyVal;
}
код компилится с помощью Borland C++Builder 6 в MyDll.dll файл
Вызывать пробую так (предварительно скопировав MyDl.dll в bin\ папку VS проекта):
public class Container
{
[DllImport("MyDll.dll",CharSet=CharSet.Auto, SetLastError=true)]
public static extern int MyFunction(int a);
}
class Class1
{
[STAThread]
static void Main(string[] args)
{
int a=Container.MyFunction(5);
Console.WriteLine(a);
}
}
но на строке "int a=Container.MyFunction(5);" получаю Exception:
An unhandled exception of type 'System.DllNotFoundException' occurred in Test.exe
Additional information: Unable to load DLL (MyDll.dll).
Почему?