OpenLibrary() twice on the same DLL?

Just starting out? Need help? Post your questions and find answers here.
mikejs
Enthusiast
Enthusiast
Posts: 175
Joined: Thu Oct 21, 2010 9:46 pm

OpenLibrary() twice on the same DLL?

Post by mikejs »

Hi all,

I have a project that includes a couple of libraries via IncludeFile. Both of these libraries happen to need functions (not the same functions) from a particular DLL, and so both are setting up prototypes and calling OpenLibrary() to get functions from that DLL.

This means that OpenLibrary() is being called twice for the same DLL. Empirically, this seems to work, but I'm not sure whether this is something that's best avoided.

Is this OK, or a Bad Idea?
Quin
Addict
Addict
Posts: 1134
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: OpenLibrary() twice on the same DLL?

Post by Quin »

To the best of my knowledge this is fine, as long as you don't want each instance of the DLL to have separate data segments or whatever. If you're just calling functions, it'll work, or at least it always has for me. Just... remember to use #PB_Any or be very strict with CloseLibrary() :wink:
Post Reply