loadlib.h 663 B

1234567891011121314151617181920212223242526272829303132333435
  1. #ifndef _LOADLIB_H
  2. #define _LOADLIB_H
  3. #include <bfc/wasabi_std.h>
  4. #include <bfc/named.h>
  5. class Library : public NamedW
  6. {
  7. public:
  8. Library(const wchar_t *filename=NULL);
  9. Library(const Library &l) {
  10. lib = NULL; // FG> overrides default constructor, so we need to init this too...
  11. load(l.getName());
  12. }
  13. ~Library();
  14. Library& operator =(const Library &l) {
  15. if (this != &l) {
  16. unload();
  17. load(l.getName());
  18. }
  19. return *this;
  20. }
  21. int load(const wchar_t *filename=NULL);
  22. void unload();
  23. void *getProcAddress(const char *procname);
  24. OSMODULEHANDLE getHandle() const { return lib; }
  25. private:
  26. OSMODULEHANDLE lib;
  27. };
  28. #endif