Troubleshooting DLL loading

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Troubleshooting DLL loading

Richard Sargent
Administrator
I've spun this off from David Pennington's thread so that it can be more easily found.

There is a tool that can be very helpful in diagnosing load problems. It's located at http://www.dependencywalker.com/.


The following Smalltalk Do It can be helpful, as well. (There are Windows settings that would open a dialogue if there is a problem loading the DLL or its dependencies. The script doesn't mess with those settings, but could. See Microsoft's SetErrorMode function.)
 | module fileName |

fileName
:= GbsConfiguration current libraryName. "fileName can be fully qualified"
"get DLL handle to see if it is already loaded"
(module := OSHmodule getModuleHandle: fileName) isNull ifTrue:
 
["load the DLL"
 
module := OSHmodule loadLibrary: fileName].
module isNull
    ifTrue
: [self error: 'could not load the dll']
    ifFalse
: ["free the DLL"
       
module freeLibrary
            ifTrue
: ['success']
            ifFalse
: [self error: 'could not unload the dll']]





--
You received this message because you are subscribed to the Google Groups "VA Smalltalk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/va-smalltalk.
For more options, visit https://groups.google.com/d/optout.
Loading...