Results 1 to 3 of 3

Thread: shader.lib is not up to date for visualstudio 2015 ..

  1. #1
    Join Date
    Nov 2008
    Location
    Mantova
    Posts
    352

    Exclamation shader.lib is not up to date for visualstudio 2015 and later ..

    Basically, the definitions of all of the print functions have been moved inline. That's a breaking change that leads to linker errors, for example :

    shader.lib(shader.obj) : error LNK2019: unresolved external symbol __iob_func referenced in function mi_matrix_ident
    shader.lib(shader.obj) : error LNK2019: unresolved exernal symbol fprintf referenced in function mi_matrix_ident
    shader.lib(shader.obj) : error LNK2019: unresolved external symbol vsnprintf referenced in function mi_fatal

    You can take a look here for what changed but basically you just need to recompile with vs >= vs2015 :
    https://msdn.microsoft.com/en-us/lib...44.aspx#BK_CRT

    shader.lib comes with 3.14.5.1 devkit.


    Eventually, the temporary fix for those that wanna use vs2015 to compile their shaders :

    #if defined(_MSC_VER) && _MSC_VER >= 1900
    // use the legacy stdio defs
    #pragma comment(lib, "legacy_stdio_definitions.lib")

    // however the above doesn't fix the __imp___iob_func link error
    #include <stdio.h>
    extern "C" { FILE __iob_func[3] = { *stdin,*stdout,*stderr }; }
    #endif

    or if you don't plan to use the legacy_stdio_definitions lib, try this :

    #if defined(_MSC_VER) && _MSC_VER >= 1900
    #include <stdio.h>
    extern "C" { FILE __iob_func[3] = { *stdin,*stdout,*stderr }; }
    int (WINAPIV * __vsnprintf)(char *, size_t, const char*, va_list) = _vsnprintf;
    int (WINAPIV * __fprintf)(FILE*const, const char* const, ...) = fprintf;
    #endif

    max
    Last edited by maxt; November 7th, 2017 at 19:21.

  2. #2
    Join Date
    Jan 2009
    Location
    Berlin/Germany
    Posts
    1,132

    Default

    Hi Max,

    nowadays, we ship the source file shader.c that you should compile along with your custom shader code.
    That avoids the problems with pre-compiled shader.lib not matching your build environment.

    Hope this helps,
    Steffen

  3. #3
    Join Date
    Nov 2008
    Location
    Mantova
    Posts
    352

    Default

    Good, thanks Steffen.

    ciao, max

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •