S
Steffen Loringer
Hello,
I'm trying to understand usage of an C++ DLL in an C# application. The
example is easy but stops when execution the C# Console App with the
following exception:
System.EntryPointNotFoundException was unhandled
WrapperTest.wrapper.Multiply(Int32 a, Int32 b)
My DLL,compiled in VS 2005:
// Header "testdll.h"
class __declspec(dllexport) Testclass
{
public:
Testclass();
~Testclass();
int Multiply(int a, int b);
};
// Sourcefile "testdll.cpp"
#include <iostream>
using namespace std;
#include "testdll.h"
int Testclass::Multiply(int a, int b)
{
return (a * b);
}
and finally the C# Console App
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace WrapperTest
{
class Program
{
static void Main(string[] args)
{
int x;
x = wrapper.Multiply(2, 3);
System.Console.WriteLine("C# Application startet");
System.Console.WriteLine(x);
}
}
class wrapper
{
[DllImport("TestDLL.dll")]
public static extern int Multiply(int a, int b);
}
}
Any hints for me?
Thanks a lot
Steve
I'm trying to understand usage of an C++ DLL in an C# application. The
example is easy but stops when execution the C# Console App with the
following exception:
System.EntryPointNotFoundException was unhandled
WrapperTest.wrapper.Multiply(Int32 a, Int32 b)
My DLL,compiled in VS 2005:
// Header "testdll.h"
class __declspec(dllexport) Testclass
{
public:
Testclass();
~Testclass();
int Multiply(int a, int b);
};
// Sourcefile "testdll.cpp"
#include <iostream>
using namespace std;
#include "testdll.h"
int Testclass::Multiply(int a, int b)
{
return (a * b);
}
and finally the C# Console App
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace WrapperTest
{
class Program
{
static void Main(string[] args)
{
int x;
x = wrapper.Multiply(2, 3);
System.Console.WriteLine("C# Application startet");
System.Console.WriteLine(x);
}
}
class wrapper
{
[DllImport("TestDLL.dll")]
public static extern int Multiply(int a, int b);
}
}
Any hints for me?
Thanks a lot
Steve