MCPcopy Create free account
hub / github.com/ReadyTalk/avian / Library

Class Library

src/system/windows.cpp:600–656  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

598 };
599
600 class Library : public System::Library {
601 public:
602 Library(System* s, HMODULE handle, const char* name)
603 : s(s), handle(handle), name_(name), next_(0)
604 {
605 }
606
607 virtual void* resolve(const char* function)
608 {
609 void* address;
610 FARPROC p = GetProcAddress(handle, function);
611 memcpy(&address, &p, BytesPerWord);
612 return address;
613 }
614
615 virtual const char* name()
616 {
617 return name_;
618 }
619
620 virtual System::Library* next()
621 {
622 return next_;
623 }
624
625 virtual void setNext(System::Library* lib)
626 {
627 next_ = lib;
628 }
629
630 virtual void disposeAll()
631 {
632 if (Verbose) {
633 fprintf(stderr, "close %p\n", handle);
634 fflush(stderr);
635 }
636
637 if (name_) {
638 FreeLibrary(handle);
639 }
640
641 if (next_) {
642 next_->disposeAll();
643 }
644
645 if (name_) {
646 ::free(const_cast<char*>(name_));
647 }
648
649 ::free(this);
650 }
651
652 System* s;
653 HMODULE handle;
654 const char* name_;
655 System::Library* next_;
656 };
657

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected