I currently have code based on these three files being in the same parent directory as my main python file. I am now attempting to refactor things before I continue development and would like to move said library code into it's own lib/ directory. Unfortunately, nothing I've tried helps.

import ctypes
_lib = ctypes.cdll["./my.dll"]

The above code located in the python wrapper file loads the dll perfectly fine in it's original location. I've tried various ways of loading it in the new location such as:

What happens if you try ctypes.util.find_library('dll_name')? Is the parent directory in the system search path? (Are you using Windows? What version? And what version of Python?)
–
VelociraptorsJan 21 '11 at 19:33

I'm using python 2.7 on windows 7 x64; the directory in question definitly isn't on the path. I don't see why it should NEED to be on the path since 1) it's in the same directory as the script calling for it and 2) i'm passing an absolute path to it. I'll update with the results of your suggestion this evening when I make it back home.
–
jdsmith2816Jan 21 '11 at 20:19

find_library() uses the system search path. If the parent directory were on the path, that might have explained why it worked before you moved the dll. Since it's not, more information might help.
–
VelociraptorsJan 21 '11 at 20:48

Yes, sorry; I was typing the second codeblock from memory since I had already reverted things back to how they were so that I could continue with other refactorings; question edited to reflect the proper call. If it would help I'll get the exact error message when I get home later tonight but it was simply reporting that it could not find the module.
–
jdsmith2816Jan 21 '11 at 19:07