On 10.08.2012 23:20, Patrice Colet wrote:
the mail reply says how MSVC is involved,
"int _get_output_format( void ); is a standard MSVC function"
http://msdn.microsoft.com/en-us/library/571yb472(v=vs.80).aspx
the problem is certainly because stdlib is different on windows, for
exemple vasprintf() is missing,
you have to provide it into the sources, like we have done on
gridflow, or provide another function.
gcc seems to try mscv's _get_output_format() for resolving it without
success...
It must be a linker problem: When I compile the test application for json-c with MXE, then there is no problem at all, and I can run the program in Windows correctly.
Another thing, I've used s_list in an external that compiles fine with g++ linking and declspec embedding...
can you post all the compile process, and what is your linker?
My complete compile process is this:
cross compilation tools and necessary libraries (make curl json-c libiberty pthreads). 1a. (optional) Run built test application in Windows to ensure correct build process 2. Get PuREST JSON (https://github.com/residuum/PuRestJson). The Makefile uses the template 1.0.12. NB: The Makefile in the repository is not the same one as on my local machine, I will push it once cross compilation is possible. 3. Run make UNAME=MINGW CROSS=i686-pc-mingw32 CROSS_PATH=/opt/mxe/usr PD_PATH=/home/thomas/src/Pd-0.42.5-extended/pd-win
Output: i686-pc-mingw32-gcc
-I"/home/thomas/src/Pd-0.42.5-extended/pd-win/include/pd" -std=c99 -DPD
-DVERSION='"0.7.1"' -mms-bitfields
-I"/home/thomas/src/Pd-0.42.5-extended/pd-win/src" -mthreads -Wall -W -g
-I/opt/mxe/usr/i686-pc-mingw32/include -O3 -funroll-loops
-fomit-frame-pointer -o "libpurest_json.o" -c "libpurest_json.c"
i686-pc-mingw32-gcc -shared -o libpurest_json.dll libpurest_json.o
-lcurl -ljson -L"/home/thomas/src/Pd-0.42.5-extended/pd-win/src"
-L"/home/thomas/src/Pd-0.42.5-extended/pd-win/bin"
-L"/home/thomas/src/Pd-0.42.5-extended/pd-win/obj" -lpd -lwsock32
-lkernel32 -luser32 -lgdi32 -liberty -lpthread
libpurest_json.o: In function output_json': /home/thomas/src/pd/my-objects/purest_json/libpurest_json.c:145: undefined reference to
s_list'
/opt/mxe/usr/lib/gcc/i686-pc-mingw32/4.7.1/../../../../i686-pc-mingw32/lib/libjson.a(printbuf.o):
In function vasprintf': /opt/mxe/tmp-json-c/json-c-0.10/printbuf.c:130: undefined reference to
_vscprintf'
/opt/mxe/usr/lib/gcc/i686-pc-mingw32/4.7.1/../../../../i686-pc-mingw32/lib/libmingwex.a(pformat.o):pformat.c:(.text+0x1732):
undefined reference to `_get_output_format'
collect2: error: ld returned 1 exit status
make: *** [libpurest_json.dll] Fehler 2
I am not sure, how to get information about the linker used, and how to set it in the Makefile. That was part of the original question, apparently setting LD in the Makefile is not enough (see https://gist.github.com/3307768).
Thanks for your help, Thomas