Hi Alan To be clear - Plplot built fine for me with VS 2015 even with snprintf not being found. The only issue on my PC was with including other static libraries built with previous VS versions and statically linked to the runtime. So shapelib was built expecting to find snprintf in the runtime library. Whether or not CMake finds the new inline version of snprintf in the VS 2015 runtime is irrelevant. The function definition is not in that runtime library so it can't be found to link against the instance in shapelib.
The solution there is to rebuild all static libraries used by plplot using the same VS version. Alternatively I think using dlls instead or dynamically linking to the runtime might fix the problem. Anyway I tested and CMake does now find snprintf, but x00.exe will not link because my shapelib was built with VS 2012. This doesn't mean that your change is incorrect. It just means I need to rebuild shapelib with VS2015 too. Phil On 4 September 2015 at 00:56, Alan W. Irwin <ir...@beluga.phys.uvic.ca> wrote: > On 2015-09-03 22:06+0100 Phil Rosenberg wrote: > >> [...] Note that both snprintf and _snprintf are listed as not found by >> cmake. But this isn't a blanket loss of the check_function_exists() >> function. isnan and isfinite are both found and I presume they use >> check_function_exists()? >> >> I then reread your email and found you provided a rather shorter test. >> I dumped this in a cmakelists.txt file and this could not find >> snprintf either >> >> >> I figured we can't be the only people having this issue so I googled >> it and found this page >> >> http://public.kitware.com/Bug/bug_relationship_graph.php?bug_id=15659&graph=relation >> >> It seems that snprintf and a number of other io related functions are >> now defined inline in stdio.h. This explains my linker errors above >> when shapelib was included - snprintf was not found because it is no >> longer in the library. The answer apparently is to use >> CheckSymbolExists instead. >> >> The following works correctly >> >> cmake_minimum_required(VERSION 2.8.9) >> project(test_check C) >> include(CheckSymbolExists) >> check_symbol_exists(snprintf stdio.h PL_HAVE_SNPRINTF) >> message(STATUS "PL_HAVE_SNPRINTF = ${PL_HAVE_SNPRINTF}") > > >> So this is really nothing to do with the new "Universal" nature of the >> CRT, it's just that the new CRT has inlined those particular >> functions. > > > Hi Phil: > > Thanks very much for the above investigation. > >> >> Alan I will leave you to integrate this how you see fit as I wouldn't >> know where to start. >> > > It turns out we use check_function_exists a lot of places in our build > system, but I don't think any of those have to do with io-related > functions other than the checks for snprintf and _snprintf. So I have > only changed those two instances (see commit id ac0f09f) to use the > check_symbol_exists form that you found above works for you (and > which also works for me on Linux). > > To finish off this topic, please test this latest version of PLplot > for your Visual Studio 2015 platform and assuming that the PLplot > build shows no other check_function_exists failures, then please close > the bug report appropriately. > > > Alan > __________________________ > Alan W. Irwin > > Astronomical research affiliation with Department of Physics and Astronomy, > University of Victoria (astrowww.phys.uvic.ca). > > Programming affiliations with the FreeEOS equation-of-state > implementation for stellar interiors (freeeos.sf.net); the Time > Ephemerides project (timeephem.sf.net); PLplot scientific plotting > software package (plplot.sf.net); the libLASi project > (unifont.org/lasi); the Loads of Linux Links project (loll.sf.net); > and the Linux Brochure Project (lbproject.sf.net). > __________________________ > > Linux-powered Science > __________________________ ------------------------------------------------------------------------------ _______________________________________________ Plplot-devel mailing list Plplot-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/plplot-devel