Wow, good job. You're really moving forward with this.
I noticed in the diff for your commit on master of the fork of miniupnp:
- <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;MINIUPNP_STATICLIB;DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+ <PreprocessorDefinitions>_CRT_SECURE_NO_WARNINGS;DEBUG;%(PreprocessorDefinitions);</PreprocessorDefinitions>
It seems the
MINIUPNP_STATICLIB define was removed from the pre-processor definitions, and then added to the source file.
This is confusing, since I would expect that to not be defined for a DLL build.
I checked back to the prior commit.
Checking the file:
miniupnpc/msvc/miniupnpc.vcxproj, I noticed there were 4 project configurations:
Debug Dll,
Debug,
Release Dll, and
Release. As expected, the
Debug and
Release configurations have their
ConfigurationType set to
StaticLibrary, and have a
PreprocessorDefinitions list including
MINIUPNP_STATICLIB.
It looks like the project already has configurations for both DLL and static library builds.
Perhaps the original problem was simply a matter of changing which configuration got built?
(And of course the toolset upgrade)
The project file changes for libnatpmp look more extensive. Looked like the solution file was for an older version, and the upgrade amounted to basically rewriting the whole file, and adding all new project files. Curiously, I noticed the project file was split, with DLL builds in one project file, and static library builds in the other file, rather than having all 4 configurations in one project file.
It looks like the static configuration project file already has the necessary
NATPMP_STATICLIB preprocessor macro defined. I don't think it needs to be added to the source file as well.
Looks like the new project files would be useful to contribute back to the original author. I might suggest combining all 4 configurations into one project file though.
The
#define ssize_t SSIZE_T looks relevant, and may be worth contributing back. I don't know enough about it to really comment on it.
I'd be curious to know how the
#define interacts with older versions of the Windows kits.
From my cursory reading, it sounds like
ssize_t is a signed version of
size_t, used when a negative return value is used as a sentinel value, for what would otherwise be a positive
size_t type value. It's part of Posix, but not part of the C/C++ standards.