#ifndef ROKEN_LIB_FUNCTION
#ifdef _WIN32
-#define ROKEN_LIB_FUNCTION
-#define ROKEN_LIB_CALL __cdecl
+# define ROKEN_LIB_CALL __cdecl
+# ifdef ROKEN_LIB_DYNAMIC
+# define ROKEN_LIB_FUNCTION __declspec(dllimport)
+# define ROKEN_LIB_VARIABLE __declspec(dllimport)
+# else
+# define ROKEN_LIB_FUNCTION
+# define ROKEN_LIB_VARIABLE
+# endif
#else
#define ROKEN_LIB_FUNCTION
#define ROKEN_LIB_CALL
+#define ROKEN_LIB_VARIABLE
#endif
#endif
#endif
#if !HAVE_DECL_OPTARG
-extern char *optarg;
+ROKEN_LIB_VARIABLE extern char *optarg;
#endif
#if !HAVE_DECL_OPTIND
-extern int optind;
+ROKEN_LIB_VARIABLE extern int optind;
#endif
#if !HAVE_DECL_OPTERR
-extern int opterr;
+ROKEN_LIB_VARIABLE extern int opterr;
#endif
#ifndef HAVE_GETIPNODEBYNAME