public IntPtr initPathEx(string dllpath) { if (DllLib == IntPtr.Zero) { DllLib = Loaddll.LoadLibraryEx(dllpath, DllLib, LOAD_WITH_ALTERED_SEARCH_PATH); } return(DllLib); }
public IntPtr initPath(string dllpath) { if (DllLib == IntPtr.Zero) { DllLib = Loaddll.LoadLibrary(dllpath); } return(DllLib); }
/// <summary> /// 获取DLL中一个方法的委托 /// </summary> /// <param name="methodname"></param> /// <param name="methodtype"></param> /// <returns></returns> public Delegate InvokeMethod(string methodname, Type methodtype) { IntPtr MethodPtr = Loaddll.GetProcAddress(DllLib, methodname); return((Delegate)Marshal.GetDelegateForFunctionPointer(MethodPtr, methodtype)); }
public void freeLoadDll() { Loaddll.FreeLibrary(DllLib);//释放名柄 DllLib = IntPtr.Zero; }
public LoadDllapi(string dllpath) { DllLib = Loaddll.LoadLibrary(dllpath); }