Home page logo

nmap-dev logo Nmap Development mailing list archives

Re: [Patch] 'static inline' and MSVC
From: Henri Doreau <henri.doreau () gmail com>
Date: Wed, 12 Feb 2014 10:18:08 +0100

2014-02-12 10:04 GMT+01:00 Gisle Vanem <gvanem () yahoo no>:
The new 'static inline' functions in nbase.h breaks my MSVC v16
build. E.g. static inline int checked_fd_isset ( ...

MSVC v16 has no 'inline' in C, but '__inline'. Not sure if a more
recent MSVC has a native 'inline'. Looking at how libpcap does this, I don't
think so.  A patch that works for me:

--- svn-latest/nbase/nbase.h        2014-02-10 05:12:34 +0000
+++ nbase/nbase.h    2014-02-12 09:05:12 +0000
@@ -368,6 +368,9 @@
#define DEVNULL "/dev/null"

+#if defined(_MSC_VER) && !defined(__cplusplus) && !defined(inline)
+#define inline __inline

static inline int checked_fd_isset(int fd, const fd_set *fds) {
#ifndef WIN32


Thanks Gisle,

My bad, I wasn't expecting this to break anything. How does MSVC deal
w/ the inline functions that are defined in nsock_internal.h[1] for
instance? We don't compile nsock as C++, do we? Your patch seems good
to me. Any concern from a Windows developer?


[1] https://svn.nmap.org/nmap/nsock/src/nsock_internal.h

Sent through the dev mailing list
Archived at http://seclists.org/nmap-dev/

  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]