in reply to Re^2: How to use Win32::API to access variable in DLL file?
in thread How to use Win32::API to access variable in DLL file?

If I use Win32 to access the variables and Win32::API to access the functions, would the two modules load different instances of the dll?

No. If the dll in question is already loaded, then LoadLibrary() just returns a handle to it.

If I understand correctly, I suspect that I can follow your example and by using only the pack 'L!', $proc syntax of the last line to get the address of variables and functions. With that, I should be able to get any variable or function in my code to 'point' to a corresponding variable/function in the dll and would not necessarily need Win32::API. Then I don't have to worry about the possibility of my code accessing different instances of the dll.

Like I say, not a possibility. Besides which, whilst you can get the procedure addresses in the same way, the Pure Perl technique for invoking that address is still lost in the mists of time. On top of that, how would you set up the parameter passing?


Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
RIP PCW
  • Comment on Re^3: How to use Win32::API to access variable in DLL file?

Replies are listed 'Best First'.
Re^4: How to use Win32::API to access variable in DLL file?
by dasgar (Priest) on Jun 29, 2009 at 15:06 UTC
    You were correct about using the modules will not create seperate instances of the dll. I was able to successfully use the driver dll to access the device and to access the dll's global variable to determine if errors occurred.

    Thanks for the information and help. I really appreciate it.