W dniu 2013-07-20 20:00, Paul Fertser pisze:
> I think that's a red herring. 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'". Why doesn't mingw
> see that cross-compiled libusb-1.0 on your system is new enough and
> actually has that function? The function prototype doesn't matter for
> linkage, and autoconf test here is caring only about the linkage.

It's not - check my first message. If I replace the faulty declaration 
of the function (without WINAPI and without parameters) with:

#include <libusb-1.0/libusb.h>

(and add the parameter to the actuall call) everything works perfectly. 
And the only differences are:
- WINAPI
- single parameter.

WINAPI causes name-mangling - the linker checks for "libusb_error_name", 
but the real name of this function for windows is "_libusb_error_name@4" 
- all because of WINAPI and a single 4-byte parameter. The function 
prototype here is crucial, because WINAPI calls are NOT normal function 
calls and the configure test checks for a plain "normal" function.

If I manually include <windows.h> and add WINAPI to the prototype it 
still fails, but this time there's an undefined reference to 
"_libusb_error_name@0", because the prototype says the function takes no 
parameters.

Take a look at my first message in the thread - all the details, with my 
version of the test that works - are there.

4\/3!!

------------------------------------------------------------------------------
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

Reply via email to