From: Xiaofan C. <xia...@gm...> - 2011-08-30 05:46:54
|
On Tue, Aug 30, 2011 at 4:03 AM, Vitali Lovich <vl...@gm...> wrote: > On Mon, Aug 29, 2011 at 6:38 AM, Xiaofan Chen <xia...@gm...> wrote: >> I am trying to build libftdi-0.1x and libftdi-1.0 using MSVC2010 >> with the help of CMake. >> >> For libftdi-0.1x, the library build is successful. >> >> For libftdi-1.0, the library build failed. Maybe this has something >> to do with the calling convention of libusb-1.0 (default is stdcall). >> Take note building using MinGW is okay. >> >> Error 372 error C2440: 'function' : cannot convert from 'void >> (__cdecl*)(libusb_transfer *)' to 'libusb_transfer_cb_fn' >> D:\work\libftdi\libftdi-1.0\src\ftdi.c 1417 1 ftdi-static >> Error 376 error C2440: 'function' : cannot convert from 'void >> (__cdecl*)(libusb_transfer *)' to 'libusb_transfer_cb_fn' >> D:\work\libftdi\libftdi-1.0\src\ftdi.c 1500 1 ftdi-static >> Error 806 error C2440: 'function' : cannot convert from 'void >> (__cdecl*)(libusb_transfer *)' to 'libusb_transfer_cb_fn' >> D:\work\libftdi\libftdi-1.0\src\ftdi_stream.c 200 1 ftdi-static >> >> Any suggestion for the potential fix? Thanks in advance. >> >> libftdi-1.0 git tree is here. >> http://developer.intra2net.com/git/?p=libftdi-1.0;a=summary > > Have you tried declaring those callback functions as stdcall explicitly? > Thanks. This works. Add LIBUSB_CALL to the function definitions solved the above problems. Then google helped me to find out the MSVC replacement of gettimeofday() here. http://stackoverflow.com/questions/2494356/how-to-use-gettimeofday-or-something-equivalent-with-visual-studio-c-2008 After that, I can build libftdi-1.0 with MSVC (the dll and static lib and two examples). The two examples seem to work as well. -- Xiaofan |