On Thu, Mar 20, 2008 at 3:42 PM, Craig <[EMAIL PROTECTED]> wrote: > > On Mar 20, 2:38 pm, Craig <[EMAIL PROTECTED]> wrote: > > On Mar 20, 2:29 pm, sturlamolden <[EMAIL PROTECTED]> wrote: > > > > > On 20 Mar, 19:09, Craig <[EMAIL PROTECTED]> wrote: > > > > > The culprit i here: > > > > > > Before - X = 0, CacheSize = 0, OpenMode = 3, vHandle = 0 > > > > > This binds these names to Python ints, but byref expects C types. > > > > > Also observe that CacheSize and OpenMode should be c_short. > > > > I changed CacheSize and OpenMode to c_short, and commented out that > > line producing the "Before" message, and the output is the same. > > > > Further "tinkering" revealed that it is the byref on the fName and pw > > that are causing the error. > > > > The entire problem appears to be around the production of a BSTR and > > the passing of pointers (byref) to the BSTR. > > > Can anyone shed some light on how to work with BSTR's?
Since you didn't tell ctypes about the function signature, it assumes it returns int and gives you a python int. Provide a function signature (c_void_p should work for BSTR) for both functions and you should have an easier time of it. > > > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list