I’m discovering just how many errors and problems masquerade as “function not found” errors
I’m working on a windows 64bit app declaring a function in an external library.
*** it works fine for compiling as a Windows 32bit app ***
So, I’ve looked at:
the version of the library, I’ve confirmed that I’m using the 64bit version (at least as supplied)
the calling convention, thinking 32bit integers vs 64bit integers, etc but then I tried:
the location of the library. things might be different under 64bit, so I move the library to the root folder of the app, but then I think
is it finding the library at all? I remove the library entirely and get the same error
So where to go from here? Don’t forget that it all worked fine in 32bit. The parameters to be sent & returned are all explicitly Int32-type stuff and all docs suggest nothing about any 64bit differences with the library… help…
aer you sure its not a 32 bit DLL ?
a 64 bit app wont load a 32 bit DLL and a 32 bit one obviously cannot load a 64 bit one
And that will give you errors like function not found becuase the dll isnt open or loaded
Assuming it’s not 32 vs 64 bit mismatch, try dumping a list of the DLL’s exported functions using a tool like DLL Export Viewer. This will let you see all the functions in the DLL and their true names.
First, yes, it appears to be a 64bit DLL. I downloaded Dependency Walker and it claims the DLL is 64bit
Second, I used the DLL Export Viewer and it states the function name I’m using is correct
So I’m still at a loss. I expect the “function not found” error is in response to something returned from the OS but it’s a pain that I can’t tell the difference between a DLL being unavailable or using the wrong function name or…
when you debug quite literally WHERE is the DLL relative to the EXE being built for debugging ?
how do you get it there ?
maybe its not there at the right time (if you copy it manually after starting to debug or something ?)
You CAN - just then you dont use a declare as it doesnt tell you this
If you resorted to the lower level Windows API’s for loading a library and getting access to its entry points that could tell you all these details
Declares dont - they spare you the gorey details (but also hide some things as you’ve seen)
Unfortunately I got “DLL not found” no matter what I tried.
I ensured that the DLL was in the same folder as the executable and that it was properly named in the LoadLibraryW call
I reviewed it again with the Dependency Walker utility and found the following errors:
Error: At least one required implicit or forwarded dependency was not found.
Error: At least one module has an unresolved import due to a missing export function in an implicitly dependent module.
Error: Modules with different CPU types were found.
Warning: At least one delay-load dependency module was not found.
Warning: At least one module has an unresolved import due to a missing export function in a delay-load dependent module.
There are about 12 dlls that make up this library but I did confirm that the function I’m attempting to call is within the dll file I reference in the LoadLibraryW call
So, I tried an earlier version of the manufacturer’s library to see if it was a bad build or something… no dice (same errors in Dependency Walker as well)
I should mention that I can successfully call a dll from a different manufacturer, so it would appear I’m doing something correctly…
Also, do recall that this all works when compiling for 32bits with the 32bit set of dlls that are supplied
These problem dlls are included with working sample C++ code (they claim, I did not compile it myself) and a working build of their demo app…
It sounds like the interdependencies are flummoxing the loading of the library… any ideas?
You might have a missing 64bit runtime library that the dll depends on, check where you got the app/dll from to see if they have a pre-requisite for the 64bit version of the app/dll, try it after installing the 64bit version of that. Failing that see the following on how to deubg the load failure: