I made a simple dll written in vb6
VB Code:
Public Static Function TEST(ByVal x As Integer) On Error GoTo error MsgBox ("aaa") Exit Function error: TEST = 0 End Function
I compiled and then made a c# project to use it
When i run the exe it gives me an errorCode:using System; using System.Security; using System.Security.Permissions; using System.Runtime.InteropServices; using System.Windows.Forms; namespace teste { class NativeMethods { [SuppressUnmanagedCodeSecurityAttribute()] [DllImport("C:\\TEST.dll")] extern public static int TEST(int x); } class MainClass { [SecurityPermission(SecurityAction.Deny, Flags = SecurityPermissionFlag.UnmanagedCode)] public void CallUnmanagedCodeWithPermission() { try { NativeMethods.TEST(1); MessageBox.Show("OK"); } catch (SecurityException e) { MessageBox.Show("ERROR:" + e.Source + e.Message); } } } }
Any ideas how to solve this .Code:An unhandled exception of type 'System.EntryPointNotFoundException' occurred in teste.exe Additional information: Unable to find an entry point named TEST in DLL C:\TEST.dll.
Thanks




Reply With Quote