/* * 如果是载入dll出错,则返回0;如果载入dll成功但寻找函数入口失败,则返回1,如果全部成功,则返回2 */ public int init(string strategyFile, string who) { hDLL = DLLWrapper.LoadLibrary(strategyFile); if (hDLL == 0) { MessageBox.Show("Failed to load dll" + who + " :\n" + strategyFile + "\nIs it a dll or is it in use now?"); return(0); } getPoint = (GET_POINT)DLLWrapper.GetFunctionAddress(hDLL, "getPoint", typeof(GET_POINT)); clearPoint = (CLEAR_POINT)DLLWrapper.GetFunctionAddress(hDLL, "clearPoint", typeof(CLEAR_POINT)); if (getPoint == null || clearPoint == null) { MessageBox.Show("Failed to find desired functions in dll" + who + " :\n" + strategyFile + "\nHave you chosen a right dll?"); return(1); } return(2); }
public void release() { DLLWrapper.FreeLibrary(hDLL); return; }