靜態庫
// 相對路徑 或者 絕對路徑 #include "yourlib.h" //相對路徑 或者 絕對路徑 #pragma comment(lib, "yourlib.lib") int main() { int ret = 0; // lib里的函數 ret = funcInYourLib(int param1); }
動態庫
#include <Windows.h> typedef int (__stdcall *Func)(int param); int main() { int ret = 0; // 相對路徑 或者 絕對路徑 HINSTANCE hdllInst = LoadLibrary("yourDll.dll"); Func func=(Func)GetProcAddress(hdllInst,"funcNameInDll"); ret = func(0); }