load library windows


/ Published in: C++
Save to your folder(s)



Copy this code and paste it in your HTML
  1. #include <Windows.h>
  2.  
  3. //define a functor
  4. typedef void __stdcall (*F_functionName)(int arg1, int arg2);
  5.  
  6.  
  7. HANDLE handle = LoadLibrary("LibraryName.dll");
  8. if(handle == NULL) {
  9. //error
  10. }
  11.  
  12.  
  13. //assing value to funtor
  14. F_functionName functionName = (F_functionName ) GetProcAddress(handle, "FunctionName");
  15.  
  16. //use function
  17. functionName(1,2);
  18.  
  19.  
  20. //free library when nog longer needed
  21. FreeLibrary(handle);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.