I meant retrieve the eeprom size from in the c interface, sorry. M.
From: [email protected] To: [email protected] Subject: RE: python wrapper update Date: Tue, 18 Oct 2011 06:48:23 +0000 Hi, If you want to hide memory management it would be easier to wrap around the c++ interface directly ! But that sounds tricky! But now you're pointing that out I think there's a memory leak coming from ftdi_new I think I'd rather add something like that: %newobject ftdi_new; %typemap(newfree) ftdi_context * "ftdi_free($1);"; I'll try to provide a patch soon as there's no usable wrapper around ftdi_get_eeprom_buf either I'd rather add this: %apply char *OUTPUT { unsigned char *buf }; %cstring_chunk_output( unsigned char *buf, FTDI_MAX_EEPROM_SIZE ); %typemap(default) int size { $1 = 128; } int ftdi_get_eeprom_buf(struct ftdi_context *ftdi, unsigned char * buf, int size); %clear unsigned char *buf; %clear int size; By the way is there a mean to retrieve the eeprom from in the c interface ? Regards > From: [email protected] > To: [email protected] > Subject: Re: python wrapper update > Date: Mon, 17 Oct 2011 18:17:35 +0200 > CC: [email protected] > > Hi Michel, > > On Thursday, 13. October 2011 22:52:23 xantares 09 wrote: > > I tried to enhance the python wrapper: > > - updated functions prototypes in regard to the lib > > - made OUTPUT* typemaps active as they were misplaced regarding headers > > order - allowed use of ftdi_usb_get_strings > > - added an advanced example script > > - stripped the 'ftdi_' suffix to avoid to write > > "ftdi.ftdi_usb_open(...)"; it becomes just "ftdi.usb_open(...)" - > > removed useless pointer functions since valid OUTPUT typemaps are there > > - some cleanup > > Thanks, applied! It's good you know your way around the swig stuff. > > One small question: Is it possible to tell the swig wrapper > to use ftdi_new() to allocate the internal ftdi_context structure? > > Could we also make it call ftdi_deinit() on object destruction > automatically? Calling it twice is safe. > > Cheers, > Thomas > > -- > libftdi - see http://www.intra2net.com/en/developer/libftdi for details. > To unsubscribe send a mail to [email protected] > libftdi - see http://www.intra2net.com/en/developer/libftdi for details. To unsubscribe send a mail to [email protected] -- libftdi - see http://www.intra2net.com/en/developer/libftdi for details. To unsubscribe send a mail to [email protected]
