bugpng++, a C++ wrapper for libpng - Bugs: bug #47990, __STDC_LIB_EXT1__ not found in...

 
 

bug #47990: __STDC_LIB_EXT1__ not found in Visual Studio 2015, fall back strerror_r not available

Submitter:  None
Submitted:  Mon 23 May 2016 04:30:39 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  Fixed
Privacy:  Public Assigned to:  alexshulgin
Open/Closed:  Closed
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Fri 10 Dec 2021 08:11:14 PM UTC, comment #10: 

I've updated trunk, but not sure I will be making a new release any time soon.

Thank you for reporting and confirming once again! :)

Alexander Shulgin <alexshulgin>
Group administrator
Fri 10 Dec 2021 07:59:02 PM UTC, comment #9: 

comment #8:

> Hi, indeed it does not seem to have been committed. Alex? :)


Oops, looks like I totally forgot about it.  My bad.  Let's see if I will be able to get my SVN access working again... %)

Alexander Shulgin <alexshulgin>
Group administrator
Fri 10 Dec 2021 02:56:04 PM UTC, comment #8: 

Hi, indeed it does not seem to have been committed. Alex? :)

Francois Dinel <fdinel>
Fri 10 Dec 2021 07:45:56 AM UTC, comment #7: 

Just ran into this issue when using vcpkg and VS2019 16.11.
Looks like this has already been solved and a patch created but the change wasn't committed to the repo and a new version of the library hasn't been released.

Is there any plan on releasing a new version with this fix any time soon?

Anonymous
Mon 13 Jul 2020 01:22:41 PM UTC, comment #6: 

Hi Alex,
it compiles on my system (VS2019 16.6) and it uses the secure version (strerror_s) by default.
Looks good to go! :)

Francois Dinel <fdinel>
Sun 12 Jul 2020 08:58:31 AM UTC, comment #5: 

Ah, true!  I also found an example of intended use here: https://en.cppreference.com/w/c/string/byte/strerror

Actually, we should not define the WANT macros in the library code, because there are no guarantees that the standard header was not included yet.  We should let the user define these, if needed, and only verify that the implementation provides the functions by checking the standard defines.

I've attached the 3rd patch version.  On my system the implementation does not define either of the checked symbols, so strerror_r is used ultimately.  Could you please check that this works with MSVC?  If it does, I'll commit this and also add a piece of documentation how to use it.

Thank you,
--
Alex


(file #49475)

Alexander Shulgin <alexshulgin>
Group administrator
Sun 05 Jul 2020 09:34:59 PM UTC, comment #4: 

Good point!

Actually, I think the proper way to use the "secure" functions is to first define _STDC_WANT_LIB_EXT1_ (or _STDC_WANT_SECURE_LIB_ in Visual Studio), then include the header you want and finally validate that the secure functions are defined by checking if _STDC_LIB_EXT1_ (or _STDC_SECURE_LIB_ in Visual Studio) is defined.

My second patch reflects that process... Let me know if there is a problem!

(file #49437)

Francois Dinel <fdinel>
Sun 05 Jul 2020 06:59:47 PM UTC, comment #3: 

Hi Francois,

Thank you for the patch! :)

Shouldn't we also check for "defined(_STDC_SECURE_LIB_)" before declaring that we want it on the next line?

--
Alex

Alexander Shulgin <alexshulgin>
Group administrator
Thu 02 Jul 2020 01:47:54 PM UTC, comment #2: 

Hi, I posted a patch that hopefully fixes the problem when building with Visual Studio. Let me know if it does not work...

Francois Dinel <fdinel>
Sat 20 Jul 2019 09:52:49 AM UTC, comment #1: 

Patches welcome :-(

Alexander Shulgin <alexshulgin>
Group administrator
Mon 23 May 2016 04:30:39 PM UTC, original submission:  

In Visual Studio 2015 (14.0.25123.00 Update 2) the definition _STDC_LIB_EXT1_ is not set, meaning that in error.hpp it tries to fall back to strerror_r which isn't available anymore.

Because _STDC_LIB_EXT1_ is not set, _STDC_WANT_LIB_EXT1_ is not defined, string.h is not included, and HAVE_STDERROR_S is not defined.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

Attached Files
file #49437:  use_strerror_s_with_visualstudio_2.patch added by fdinel (587B - application/octet-stream - v2)
file #49406:  use_strerror_s_with_visualstudio.patch added by fdinel (457B - application/octet-stream - Hi, here is a patch that should fix this bug. Tested in VS2019.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by fdinel (Updated the item)
  • -email is unavailable- added by alexshulgin (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-12-10 alexshulgin StatusIn Progress Fixed
        Open/ClosedOpen Closed
    2021-12-10 alexshulgin StatusNone In Progress
        Assigned toNone alexshulgin
    2020-07-12 alexshulgin Attached File- Added use_strerror_s_with_visualstudio_3.patch, #49475
    2020-07-05 fdinel Attached File- Added use_strerror_s_with_visualstudio_2.patch, #49437
    2020-07-01 fdinel Attached File- Added use_strerror_s_with_visualstudio.patch, #49406

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code