NN_ERRNO(3)

πŸ“¦
version 1.2.2 Β· 5 versions
, in fedora 44

πŸ’– NN_ERRNO(3) πŸ’–

okay bestie, so this is the nanomsg manual page for nn_errno β€” and we're on nanomsg 1.2.2, periodt. it's giving "tiny function, big Windows drama" and honestly? iconic. πŸŽ€


✨ NAME ✨

nn_errno β€” retrieve the current errno 🫢


🌸 SYNOPSIS 🌸

#include <nanomsg/nn.h>

int nn_errno (void);

πŸ¦‹ DESCRIPTION πŸ¦‹

So what does it do? It returns the value of errno for the current thread. that's it. that's the whole job. πŸ’…

On most systems, you can just reach for errno directly and this function is literally not needed. no cap. BUT β€” and here's the main character plot twist β€” on Windows, there are multiple implementations of the CRT library:

  • single-threaded
  • multi-threaded
  • release
  • debug

and every single one of them has its own instance of errno. 😭

So the way that works out: if the nanomsg library and the application that uses it link with different versions of the CRT library, they don't share the same instance of errno. Consequently, error codes set by nanomsg cannot be accessed by the application. lowkey tragic.

To overcome this problem, an application can use the nn_errno() function to retrieve nanomsg's value of errno. slay, problem solved. ✨


⭐ RETURN VALUE ⭐

Returns the value of errno for the current thread. (yes, same as above, she's consistent πŸ’–)


πŸŽ€ ERRORS πŸŽ€

No errors are defined. not a single one. she's unproblematic fr fr. πŸ™ˆ


πŸ”₯ EXAMPLE πŸ”₯

rc = nn_send (s, "ABC", 3, 0);
if (rc < 0)
    printf ("nn_send failed with error code %d\n", nn_errno ());

🌈 SEE ALSO 🌈


πŸ‘‘ AUTHORS πŸ‘‘

Martin Sustrik <sustrik@250bpm.com> β€” thank you king 🫢


and that's the whole page bestie!! this one was dated 2026-01-16, it's page NN_ERRNO(3) from the nanomsg 1.2.2 set, and yeah β€” go check your errno, she's probably fine, but on Windows maybe use nn_errno() instead. iykyk πŸ’…βœ¨

πŸ“¦ where this page comes from