|
-
Jul 21st, 2010, 10:32 AM
#1
Thread Starter
New Member
CALL Vb 6 DLL from C#- entry point error
I am getting the error : Unable to find an entry point named "Myfunc" in DLL "C:\myfunc\my.dll" from the following call from a simple VB 6.0 DLL from C# in VS2005.
This is the code and the steps I have taken.
Visual Basic 6.0 - compile the following as an ActiveX DLL.
Option Explicit
Private Declare Function MyFunc Lib "my.dll" (ByVal cmd As String) As Boolean
Private Sub Command1_Click()
If MyFunc("abc") Then
End If
End Sub
Visual Stuido 2005 - compile and run the following.
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;
namespace MyFunction
{
class Program
{
[DllImport("c:\\myfunc\\my.DLL")]
public static extern bool MyFunc(string cmd);
public static void Main(string[] args)
{
if (MyFunc("abc"))
{
}
}
}
}
To me, the following error indicates that the my.dll is being loaded okay but it can't find the function.
Here is the error:
An unhandled exception of type 'System.EntryPointNotFoundException' occurred in MyFunction.exe
Additional information: Unable to find an entry point named 'MyFunc' in DLL 'c:\myfunc\my.DLL'.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|