Paul Fertser wrote: > The real issue here is that > > i686-w64-mingw32-gcc -std=gnu99 -o conftest.exe -g -O2 > -D__USE_MINGW_ANSI_STDIO conftest.c -lusb-1.0 -lftdi -lusb > > says "undefined reference to `libusb_error_name'".
That's exactly right. > Why doesn't mingw see that cross-compiled libusb-1.0 on your system > is new enough and actually has that function? Because the source code doesn't #include the header file and because the compiler isn't told where to find the header file. Freddie Chopin wrote: > Can the actual test-case be hardcoded into the configure script? That's just a nasty workaround. The only real solution is to use pkg-config and fortunately that is absolutely trivial. John wrote: > > WINAPI causes name-mangling > > Yes. The underlying reason is that C functions by default allow > varying numbers of arguments and generate code that knows how many > were actually passed .. > calling convention Calling convention are indeed the key words. All libraries must choose which calling convention to use and for libusb we chose stdcall as it allows for maximum interoperability. Since cdecl is the default stdcall also raises the bar for all library users - they must now include the correct header. I think that's a very reasonable requirement considering the benefits, especially since they likely need other things from the header file in their program anyway. > I'm not sure the best way to fix the code - sorry - but I think it > needs doing at the C (not linker) level. The fix for this is not in the code. The fix is to use pkg-config, as I pointed out already in my review of the student code which introduced libusb-1.0 into OpenOCD in the first place. Since that code was included into openocd.git without consideration of my review effort now unfortunately more people need to waste their time in order to clean up the mess that resulted. *This* is what pkg-config does! I so hope that makes sense, but I honestly don't dare to expect anything.. //Peter ------------------------------------------------------------------------------ See everything from the browser to the database with AppDynamics Get end-to-end visibility with application monitoring from AppDynamics Isolate bottlenecks and diagnose root cause in seconds. Start your free trial of AppDynamics Pro today! http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk _______________________________________________ OpenOCD-devel mailing list OpenOCD-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/openocd-devel