EXCEPTION_ACCESS_VIOLATION???
Posted: Tue Sep 15, 2009 7:57 am
So I have tried over and over again to make some bindings to the libusb-win32 library. Every single time, when i attempt to access a certain structure returned, i get the EXCEPTION_ACCESS_VIOLATION. I'm on sbcl 1.0.29 on windows vista.
Plus, when i run the test C exe program, everything works out. But this wont...
Is there some obvious reason that its returning this, maybe i'm attempting to access something incorrectly???
Test Code:
Output:
Defs:
C Structure Defs:
Plus, when i run the test C exe program, everything works out. But this wont...

Is there some obvious reason that its returning this, maybe i'm attempting to access something incorrectly???
Test Code:
Code: Select all
(usb_init) ;;no return value
(usb_find_busses) ;;returns 1
(usb_find_devices) ;;returns 5
(let ((bus (usb_get_busses)))
(format t "BUS IS ~A~%" bus)
(loop
for device = (cffi:foreign-slot-value bus 'usb_bus 'devices)
then (cffi:foreign-slot-value device 'usb_device 'next)
until (cffi:null-pointer-p device)
do(format t "DEVICE IS ~A~%" device)))
Code: Select all
BUS IS #.(SB-SYS:INT-SAP #X02131958)
DEVICE IS #.(SB-SYS:INT-SAP #X02131964)
DEVICE IS #.(SB-SYS:INT-SAP #X00000030)
EXCEPTION_ACCESS_VIOLATION
[Condition of type SIMPLE-ERROR]
0: [RETRY] Retry SLIME REPL evaluation request.
1: [ABORT] Return to SLIME's top level.
2: [ABORT] Abort
3: [CLOSE-CONNECTION] Close SLIME connection
4: [ABORT] Exit debugger, returning to top level.
Code: Select all
(DEFCSTRUCT USB_BUS
(NEXT :POINTER) (PREV :POINTER) (DIRNAME :STRING)
(DEVICES :POINTER) (LOCATION :UNSIGNED-LONG)
(ROOT_DEV :POINTER))
(DEFCSTRUCT USB_DEVICE
(NEXT :POINTER) (PREV :POINTER) (FILENAME :STRING)
(BUS :POINTER) (DESCRIPTOR :POINTER) (CONFIG :POINTER)
(DEV :POINTER) (DEVNUM :UNSIGNED-CHAR)
(NUM_CHILDREN :UNSIGNED-CHAR) (CHILDREN :POINTER))
Code: Select all
struct usb_bus {
struct usb_bus *next, *prev;
char dirname[LIBUSB_PATH_MAX];
struct usb_device *devices;
unsigned long location;
struct usb_device *root_dev;
};
struct usb_device {
struct usb_device *next, *prev;
char filename[LIBUSB_PATH_MAX];
struct usb_bus *bus;
struct usb_device_descriptor descriptor;
struct usb_config_descriptor *config;
void *dev; /* Darwin support */
unsigned char devnum;
unsigned char num_children;
struct usb_device **children;
};