aboutsummaryrefslogtreecommitdiffstats
path: root/e_os.h
diff options
context:
space:
mode:
authorAndy Polyakov <appro@openssl.org>2008-12-22 13:54:12 +0000
committerAndy Polyakov <appro@openssl.org>2008-12-22 13:54:12 +0000
commite527201f6be3c295358bcc8b6bafec598f02dc97 (patch)
treee3b3ea15baf24f50465ad652b13f418dcc26464d /e_os.h
parent70531c147c2d38b03f109312a270ccc0af6cf8d6 (diff)
downloadopenssl-e527201f6be3c295358bcc8b6bafec598f02dc97.tar.gz
This _WIN32-specific patch makes it possible to "wrap" OpenSSL in another
.DLL, in particular static build. The issue has been discussed in RT#1230 and later on openssl-dev, and mutually exclusive approaches were suggested. This completes compromise solution suggested in RT#1230. PR: 1230
Diffstat (limited to 'e_os.h')
-rw-r--r--e_os.h28
1 files changed, 27 insertions, 1 deletions
diff --git a/e_os.h b/e_os.h
index 01d7963ecc..c6c6082c83 100644
--- a/e_os.h
+++ b/e_os.h
@@ -285,6 +285,7 @@ extern "C" {
/* yes, they have to be #included prior <windows.h> */
# endif
# include <windows.h>
+# include <stdio.h>
# include <stddef.h>
# include <errno.h>
# include <string.h>
@@ -300,13 +301,38 @@ static unsigned int _strlen31(const char *str)
# endif
# include <malloc.h>
# if defined(_MSC_VER) && _MSC_VER<=1200 && defined(_MT) && defined(isspace)
- /* compensate for bug is VC6 ctype.h */
+ /* compensate for bug in VC6 ctype.h */
# undef isspace
# undef isdigit
# undef isalnum
# undef isupper
# undef isxdigit
# endif
+# if defined(_MSC_VER) && !defined(_DLL) && defined(stdin)
+# if _MSC_VER>=1300
+# undef stdin
+# undef stdout
+# undef stderr
+ FILE *__iob_func();
+# define stdin (&__iob_func()[0])
+# define stdout (&__iob_func()[1])
+# define stderr (&__iob_func()[2])
+# elif defined(I_CAN_LIVE_WITH_LNK4049)
+# undef stdin
+# undef stdout
+# undef stderr
+ /* pre-1300 has __p__iob(), but it's available only in msvcrt.lib,
+ * or in other words with /MD. Declaring implicit import, i.e.
+ * with _imp_ prefix, works correctly with all compiler options,
+ * but without /MD results in LINK warning LNK4049:
+ * 'locally defined symbol "__iob" imported'.
+ */
+ extern FILE *_imp___iob;
+# define stdin (&_imp___iob[0])
+# define stdout (&_imp___iob[1])
+# define stderr (&_imp___iob[2])
+# endif
+# endif
# endif
# include <io.h>
# include <fcntl.h>