Troubleshooting DLL Issues with Borland DLL Explorer
What Borland DLL Explorer does
Borland DLL Explorer inspects Windows DLLs and related binaries produced by Borland/Embarcadero tools: it lists exported symbols, imported libraries, function signatures, and resource sections. Use it to verify that a DLL exposes the expected entry points, check dependencies, and inspect version/resource metadata.
Common DLL problems it helps find
- Missing exports: Function names or ordinals not present (causes unresolved symbol errors).
- Incorrect calling conventions or mangled names: C++ name mangling or wrong stdcall/cdecl leads to link/run-time failures.
- Missing dependencies: Required DLLs not found on target system (LoadLibrary/GetProcAddress failures).
- Wrong bitness: 32-bit vs 64-bit mismatches causing load errors.
- Version/resource mismatches: Embedded version info or manifests that differ from expectations.
- Export ordinal changes: Ordinal-based bindings break after rebuilds.
- Resource or manifest issues: Side-by-side (SxS) or COM registration problems.
Step-by-step troubleshooting workflow
- Open the DLL in Borland DLL Explorer and note exports and their names/ordinals.
- Verify expected exports: Compare listed exports with the header or linker .def file. If names are mangled, check compiler settings or use extern “C”.
- Check imports/dependencies: View imported DLLs; confirm those DLLs exist on the target system and have compatible architectures.
- Confirm bitness: Ensure the DLL and host process match (both 32-bit or both 64-bit).
- Examine calling conventions: Match function prototypes in headers with exported symbols; adjust stdcall/cdecl or use .def to control ordinals/names.
- Look at version/resource info and manifests: Ensure side-by-side assemblies and COM manifests are correct and that registered COM CLSIDs point to the right DLL.
- Test loadability: Use Dependency Walker or a simple test program that calls LoadLibrary/GetProcAddress to reproduce the failure and get error codes (e.g., ERROR_MOD_NOT_FOUND, ERROR_PROC_NOT_FOUND).
- Check for delayed-load or runtime dependencies: Some dependencies appear only when specific code paths run—use runtime tracing or Process Monitor to catch them.
- If using ordinals, lock them: Use .def files or linker options to fix ordinals across builds to avoid breaking consumers.
- Rebuild with diagnostics: Enable verbose linker and map file generation to confirm exported symbols and addresses.
Quick fixes by symptom
- LoadLibrary fails with ERROR_MOD_NOT_FOUND: Ensure dependent DLLs are present, check PATH/SysWOW64 vs System32, and verify bitness.
- GetProcAddress returns NULL: Name mismatch or name mangling—use correct prototype, decorated name, or export by ordinal.
- Application crashes after load: ABI mismatch—check structure packing, calling convention, and C vs C++ linkage.
- COM class not found: Confirm registration (regsvr32 or registration-free COM via manifest) and correct CLSID/ProgID in registry or manifest.
Tools to use alongside Borland DLL Explorer
- Dependency Walker / Dependencies (modern alternative)
- Process Monitor (ProcMon) for file/registry access traces
- A minimal test harness calling LoadLibrary/GetProcAddress
- Linker map files and .def files from your build
- Compiler/linker verbose output and symbol dumps
Best practices to avoid DLL issues
- Export stable names/ordinals (use .def files).
- Use extern “C” for C++ exports you intend to call from C or other languages.
- Match bitness between DLL and host.
- Include versioning and clear manifests for side-by-side assemblies.
- Provide clear dependency documentation and use installers that place required DLLs correctly.
If you want, I can produce a checklist tailored to a specific Borland/Embarcadero compiler version or help interpret a particular DLL’s export list—paste the export output and I’ll analyze it.