PRB: "Error Loading DLL" If VB .EXE Has Same Name as DLLID: Q79598
|
If you create a compiled executable program that has the same base name as
a dynamic link library (DLL) that is called from the program, an "Error
Loading DLL" message will be displayed when the compiled program attempts
to call the DLL. If the DLL is loaded before the .EXE program is run (for
example, if the DLL is in use from another application), the executable
program will not run at all.
Similarly, if an .EXE program has the same name as a loaded device driver
(.DRV) and the driver is loaded before you run the .EXE program, your
executable program will not run. For example, if you name your executable
program TIMER.EXE, it will not run because Windows has already loaded a
device driver named TIMER.DRV.
This behavior occurs because Windows checks, by module name, to see if a
program is already loaded before it tries to execute that program. If the
requested module is already loaded, Windows creates another instance of
that module. Thus, attempting to load a DLL with the same module name as an
already executing program will fail (usually with the error "Error Loading
DLL"), and attempting to start an executable program with the same module
name as an already loaded DLL will not execute the program.
Because the module name for a DLL is often the same as the name of the DLL
itself (although this can be varied using the LIBRARY entry of the module
definition file used when creating the DLL), and the module name for a
compiled Visual Basic program is the same as the original base .EXE file
name, attempting to load a DLL and a Visual Basic .EXE program that share
the same name will often result in errors.
To avoid this problem, either recompile the Visual Basic program and change the .EXE filename, or re-create the DLL, and change the LIBRARY entry in the module definition file.
This behavior is by design. It can occur with any Windows-based application, and may occur between any two Windows-based modules (either from executable programs or DLLs).
Additional query words: 2.00 3.00
Keywords :
Version :
Platform :
Issue type :
Last Reviewed: June 11, 1999