I created a test project in VB6 just to see how can I call a method from vb6 COM dll into C#. VB6 dll has method declared like this
Public Static Function Square(i As Integer) As Integer
Square = i * i
End Function
Calling from C# is below
[DllImport("C:\\Documents and Settings\\user1\\My Documents\\Visual Studio 2010\\Projects\\Interop_Example\\WindowsFormsApplication1\\WindowsFormsApplication1\\bin\\Debug\\Project1.dll")]
static extern int Square(int i);
private void button1_Click(object sender, EventArgs e)
{
int i = Square(3);
}
However line int i = Square(3) throws entrypointnotfoundexception exception, it can not find method called Square in imported dll. I am not sure why is it complaining, Am I missing something? Any suggestion is appreciated.
Thanks