diff --git a/src/array.c b/src/array.c
index 81abc7b8108319f8ba5b40bf24dd38701b336825..3b1c65b119c9c988381b6ca2d778b4a4dc25f43f 100644
--- a/src/array.c
+++ b/src/array.c
@@ -23,7 +23,7 @@
 #include "stuff.h"
 #include "bignum.h"
 
-RCSID("$Id: array.c,v 1.95 2000/11/29 21:22:21 hubbe Exp $");
+RCSID("$Id: array.c,v 1.96 2000/12/01 01:14:56 hubbe Exp $");
 
 PMOD_EXPORT struct array empty_array=
 {
@@ -1013,7 +1013,7 @@ PMOD_EXPORT struct array *compact_array(struct array *v) { return v; }
  * Get a pointer to the 'union anything' specified IF it is of the specified
  * type. The 'union anything' may be changed, but not the type.
  */
-union anything *low_array_get_item_ptr(struct array *a,
+PMOD_EXPORT union anything *low_array_get_item_ptr(struct array *a,
 				       INT32 ind,
 				       TYPE_T t)
 {
@@ -1027,7 +1027,7 @@ union anything *low_array_get_item_ptr(struct array *a,
  * The differance between this routine and the one above is that this takes
  * the index as an svalue.
  */
-union anything *array_get_item_ptr(struct array *a,
+PMOD_EXPORT union anything *array_get_item_ptr(struct array *a,
 				   struct svalue *ind,
 				   TYPE_T t)
 {
diff --git a/src/error.c b/src/error.c
index 70cc1cf0e313e07d19e490a439c60a028e392c94..6391b2d848e62b8d680dc9af6fb612b62d2bad03 100644
--- a/src/error.c
+++ b/src/error.c
@@ -21,7 +21,7 @@
 #include "threads.h"
 #include "gc.h"
 
-RCSID("$Id: error.c,v 1.63 2000/09/01 18:41:27 grubba Exp $");
+RCSID("$Id: error.c,v 1.64 2000/12/01 01:14:56 hubbe Exp $");
 
 #undef ATTRIBUTE
 #define ATTRIBUTE(X)
@@ -312,7 +312,7 @@ PMOD_EXPORT void push_error(char *description)
   f_aggregate(2);
 }
 
-struct svalue throw_value = { PIKE_T_INT };
+PMOD_EXPORT struct svalue throw_value = { PIKE_T_INT };
 int throw_severity;
 static const char *in_error;
 
diff --git a/src/errors.h b/src/errors.h
index b74f3a2f5f19413e210f3030913ab5c47feb83af..017b7ed2bf7684455e9f41b1229a0aaabe8a530f 100644
--- a/src/errors.h
+++ b/src/errors.h
@@ -2,7 +2,7 @@
 
 #ifdef ERR_DECLARE
 #define DECLARE_ERROR(NAME, INHERIT, DECL) \
-struct program *PIKE_CONCAT(NAME,_error_program); \
+PMOD_EXPORT struct program *PIKE_CONCAT(NAME,_error_program); \
 ptrdiff_t PIKE_CONCAT(NAME,_error_offset); 
 
 #define ERR_VAR(TYPE,CTYPE,RUNTYPE,NAME) TYPE NAME ;
diff --git a/src/gc.c b/src/gc.c
index f77b9fade53684f5b249064c827285d290f8dfee..d51934fd55de69662bba93ea2d7f000594b74c9c 100644
--- a/src/gc.c
+++ b/src/gc.c
@@ -30,7 +30,7 @@ struct callback *gc_evaluator_callback=0;
 
 #include "block_alloc.h"
 
-RCSID("$Id: gc.c,v 1.141 2000/10/12 01:00:41 mast Exp $");
+RCSID("$Id: gc.c,v 1.142 2000/12/01 01:14:57 hubbe Exp $");
 
 /* Run garbage collect approximately every time
  * 20 percent of all arrays, objects and programs is
@@ -948,7 +948,7 @@ static INLINE struct marker *gc_check_debug(void *a, int weak)
 
 #endif /* PIKE_DEBUG */
 
-INT32 real_gc_check(void *a)
+PMOD_EXPORT INT32 real_gc_check(void *a)
 {
   struct marker *m;
   INT32 ret;
@@ -1287,7 +1287,7 @@ int gc_mark(void *a)
   }
 }
 
-void gc_cycle_enqueue(gc_cycle_check_cb *checkfn, void *data, int weak)
+PMOD_EXPORT void gc_cycle_enqueue(gc_cycle_check_cb *checkfn, void *data, int weak)
 {
   struct gc_frame *l = alloc_gc_frame();
 #ifdef PIKE_DEBUG
diff --git a/src/interpret.c b/src/interpret.c
index 69d368e225b73f10b49e7a201a5bfec53ba4928e..4144cb1d7b9e2ed0d39370a893d18fc2a02a0275 100644
--- a/src/interpret.c
+++ b/src/interpret.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: interpret.c,v 1.174 2000/11/20 01:59:20 mast Exp $");
+RCSID("$Id: interpret.c,v 1.175 2000/12/01 01:14:58 hubbe Exp $");
 #include "interpret.h"
 #include "object.h"
 #include "program.h"
@@ -114,7 +114,7 @@ static void gc_check_stack_callback(struct callback *foo, void *bar, void *gazon
 }
 #endif
 
-void init_interpreter(void)
+PMOD_EXPORT void init_interpreter(void)
 {
 #ifdef USE_MMAP_FOR_STACK
   static int fd = -1;
@@ -1643,7 +1643,7 @@ void slow_check_stack(void)
 }
 #endif
 
-void cleanup_interpret(void)
+PMOD_EXPORT void cleanup_interpret(void)
 {
 #ifdef PIKE_DEBUG
   int e;
diff --git a/src/lex.c b/src/lex.c
index 87d7020beb2366cd3710c6b8246536ebd858fe21..963428cf5ff3016593bcf3ad12a104ddf3146684 100644
--- a/src/lex.c
+++ b/src/lex.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: lex.c,v 1.83 2000/11/25 16:32:31 grubba Exp $");
+RCSID("$Id: lex.c,v 1.84 2000/12/01 01:14:59 hubbe Exp $");
 #include "language.h"
 #include "array.h"
 #include "lex.h"
@@ -175,6 +175,7 @@ struct keyword instr_names[]=
 { "apply and return",   F_APPLY_AND_RETURN, I_HASARG },
 { "call function",      F_CALL_FUNCTION, 0 },
 { "call function & return", F_CALL_FUNCTION_AND_RETURN, 0 },
+{ "notreached!",        F_NOTREACHED, 0 },
 };
 
 struct instr instrs[F_MAX_INSTR - F_OFFSET];
diff --git a/src/modules/Java/configure.in b/src/modules/Java/configure.in
index af3bc46dec4134bb1917c39e20b71fa1efd28cea..7dd7219b28d18be14b6fdce59611fafd3dba2cfb 100644
--- a/src/modules/Java/configure.in
+++ b/src/modules/Java/configure.in
@@ -419,6 +419,11 @@ else
   :
 fi
 
+if test x"$pike_cv_sys_os" = xWindows_NT ; then
+  JAVA_LIBS="-lkernel32 -lws2_32 -ladvapi32 $JAVA_LIBS"
+fi
+
+
 LIBPATH="$OLD_LIBPATH"
 
 AC_SUBST(LINKER_OPTIONS)
diff --git a/src/modules/Java/jvm.c b/src/modules/Java/jvm.c
index c2ee106f955cf861eeead2c62ef6b7a538fabbd2..c7642cd0b33eec9317662e7c42e1b37cd7aba9b4 100644
--- a/src/modules/Java/jvm.c
+++ b/src/modules/Java/jvm.c
@@ -1,5 +1,5 @@
 /*
- * $Id: jvm.c,v 1.28 2000/10/20 00:14:12 marcus Exp $
+ * $Id: jvm.c,v 1.29 2000/12/01 01:15:04 hubbe Exp $
  *
  * Pike interface to Java Virtual Machine
  *
@@ -17,7 +17,7 @@
 #endif /* HAVE_CONFIG_H */
 
 #include "global.h"
-RCSID("$Id: jvm.c,v 1.28 2000/10/20 00:14:12 marcus Exp $");
+RCSID("$Id: jvm.c,v 1.29 2000/12/01 01:15:04 hubbe Exp $");
 #include "program.h"
 #include "interpret.h"
 #include "stralloc.h"
@@ -136,6 +136,7 @@ struct att_storage {
 #define THIS_ATT ((struct att_storage *)(Pike_fp->current_storage))
 #endif /* _REENTRANT */
 
+#include "module_magic.h"
 
 /*
 
@@ -1716,7 +1717,6 @@ static void native_dispatch(struct native_method_context *ctx,
 			    JNIEnv *env, jclass cls, void *args,
 			    jvalue *rc)
 {
-  extern struct program *thread_id_prog;
   struct thread_state *state;
 
   if((state = thread_state_for_id(th_self()))!=NULL) {
diff --git a/src/object.c b/src/object.c
index 812a45d509a85ebb94376c49e8868245b4a6dd48..b018bec42d86bed75d55d328413f653a3842e9b9 100644
--- a/src/object.c
+++ b/src/object.c
@@ -5,7 +5,7 @@
 \*/
 /**/
 #include "global.h"
-RCSID("$Id: object.c,v 1.152 2000/11/01 23:31:28 grubba Exp $");
+RCSID("$Id: object.c,v 1.153 2000/12/01 01:15:00 hubbe Exp $");
 #include "object.h"
 #include "dynamic_buffer.h"
 #include "interpret.h"
@@ -89,7 +89,7 @@ static struct object *gc_mark_object_pos = 0;
 }while(0)
 BLOCK_ALLOC(object, 511)
 
-struct object *low_clone(struct program *p)
+PMOD_EXPORT struct object *low_clone(struct program *p)
 {
   int e;
   struct object *o;
@@ -205,7 +205,7 @@ struct object *low_clone(struct program *p)
 
 
 
-void call_c_initializers(struct object *o)
+PMOD_EXPORT void call_c_initializers(struct object *o)
 {
   int e;
   struct program *p=o->prog;
@@ -1227,7 +1227,7 @@ PMOD_EXPORT struct array *object_values(struct object *o)
 }
 
 
-void gc_mark_object_as_referenced(struct object *o)
+PMOD_EXPORT void gc_mark_object_as_referenced(struct object *o)
 {
   debug_malloc_touch(o);
   debug_malloc_touch(o->storage);
@@ -1294,7 +1294,7 @@ void gc_mark_object_as_referenced(struct object *o)
   }
 }
 
-void real_gc_cycle_check_object(struct object *o, int weak)
+PMOD_EXPORT void real_gc_cycle_check_object(struct object *o, int weak)
 {
   GC_CYCLE_ENTER_OBJECT(o, weak) {
     int e;
diff --git a/src/svalue.c b/src/svalue.c
index e3f3ce45edc4717b0f1a546f627105f01db47516..c36f4207aeb9f495417589670ac4d9f403fd9dad 100644
--- a/src/svalue.c
+++ b/src/svalue.c
@@ -24,7 +24,7 @@
 #include "queue.h"
 #include "bignum.h"
 
-RCSID("$Id: svalue.c,v 1.87 2000/08/16 22:03:41 mast Exp $");
+RCSID("$Id: svalue.c,v 1.88 2000/12/01 01:15:01 hubbe Exp $");
 
 struct svalue dest_ob_zero = { T_INT, 0 };
 
@@ -1238,7 +1238,7 @@ void debug_check_svalue(struct svalue *s)
 
 #ifdef PIKE_DEBUG
 /* NOTE: Must handle num being negative. */
-void real_gc_xmark_svalues(struct svalue *s, ptrdiff_t num)
+PMOD_EXPORT void real_gc_xmark_svalues(struct svalue *s, ptrdiff_t num)
 {
   ptrdiff_t e;
 
@@ -1312,7 +1312,7 @@ void real_gc_xmark_svalues(struct svalue *s, ptrdiff_t num)
 
 #define SET_SUB_SHORT_SVALUE(V)
 
-void real_gc_check_svalues(struct svalue *s, size_t num)
+PMOD_EXPORT void real_gc_check_svalues(struct svalue *s, size_t num)
 {
 #ifdef PIKE_DEBUG
   extern void * check_for;
@@ -1354,7 +1354,7 @@ void gc_check_weak_svalues(struct svalue *s, size_t num)
 #endif
 }
 
-void real_gc_check_short_svalue(union anything *u, TYPE_T type)
+PMOD_EXPORT void real_gc_check_short_svalue(union anything *u, TYPE_T type)
 {
 #ifdef PIKE_DEBUG
   extern void * check_for;
@@ -1459,7 +1459,7 @@ void gc_check_weak_short_svalue(union anything *u, TYPE_T type)
 #define DO_MARK_STRING(U)						\
       DO_IF_DEBUG(if (U.refs && d_flag) gc_mark(U.string))
 
-TYPE_FIELD real_gc_mark_svalues(struct svalue *s, size_t num)
+PMOD_EXPORT TYPE_FIELD real_gc_mark_svalues(struct svalue *s, size_t num)
 {
   TYPE_FIELD t = 0;
   int freed = 0;
@@ -1524,7 +1524,7 @@ int gc_mark_weak_short_svalue(union anything *u, TYPE_T type)
 #define GC_DO_CYCLE_CHECK(U, TN) PIKE_CONCAT(gc_cycle_check_, TN)(U.TN, 0)
 #define GC_DO_CYCLE_CHECK_WEAK(U, TN) PIKE_CONCAT(gc_cycle_check_, TN)(U.TN, 1)
 
-TYPE_FIELD real_gc_cycle_check_svalues(struct svalue *s, size_t num)
+PMOD_EXPORT TYPE_FIELD real_gc_cycle_check_svalues(struct svalue *s, size_t num)
 {
   TYPE_FIELD t = 0;
   int freed = 0;
@@ -1558,7 +1558,7 @@ TYPE_FIELD gc_cycle_check_weak_svalues(struct svalue *s, size_t num)
   return freed ? t : 0;
 }
 
-int real_gc_cycle_check_short_svalue(union anything *u, TYPE_T type)
+PMOD_EXPORT int real_gc_cycle_check_short_svalue(union anything *u, TYPE_T type)
 {
   int freed = 0;
   debug_malloc_touch(u);
diff --git a/src/threads.c b/src/threads.c
index 44613ba0324f22959ae61d56a1e1d184786f1f77..ae027a1dde84056ea03a9ac80b4b8d59feba4865 100644
--- a/src/threads.c
+++ b/src/threads.c
@@ -1,5 +1,5 @@
 #include "global.h"
-RCSID("$Id: threads.c,v 1.145 2000/11/20 01:20:26 mast Exp $");
+RCSID("$Id: threads.c,v 1.146 2000/12/01 01:15:02 hubbe Exp $");
 
 PMOD_EXPORT int num_threads = 1;
 PMOD_EXPORT int threads_disabled = 0;
@@ -208,7 +208,7 @@ THREAD_T debug_locking_thread;
 PMOD_EXPORT MUTEX_T interpreter_lock;
 MUTEX_T thread_table_lock, interleave_lock;
 struct program *mutex_key = 0;
-struct program *thread_id_prog = 0;
+PMOD_EXPORT struct program *thread_id_prog = 0;
 struct program *thread_local_prog = 0;
 #ifdef POSIX_THREADS
 pthread_attr_t pattr;
@@ -414,7 +414,7 @@ static void dumpmem(char *desc, void *x, int size)
 #endif
 
 
-void thread_table_insert(struct object *o)
+PMOD_EXPORT void thread_table_insert(struct object *o)
 {
   struct thread_state *s = OBJ2THREAD(o);
   unsigned INT32 h = thread_table_hash(&s->id);
@@ -439,7 +439,7 @@ void thread_table_insert(struct object *o)
   mt_unlock( & thread_table_lock );  
 }
 
-void thread_table_delete(struct object *o)
+PMOD_EXPORT void thread_table_delete(struct object *o)
 {
   struct thread_state *s = OBJ2THREAD(o);
 /*  dumpmem("thread_table_delete",&s->id, sizeof(THREAD_T)); */
@@ -734,7 +734,7 @@ void f_thread_set_concurrency(INT32 args)
 }
 #endif
 
-void f_this_thread(INT32 args)
+PMOD_EXPORT void f_this_thread(INT32 args)
 {
   pop_n_elems(args);
   ref_push_object(Pike_interpreter.thread_id);
@@ -1124,7 +1124,7 @@ static void thread_was_checked(struct object *o)
 #endif
 }
 
-void f_thread_local(INT32 args)
+PMOD_EXPORT void f_thread_local(INT32 args)
 {
   static INT32 thread_local_id = 0;
 
diff --git a/src/threads.h b/src/threads.h
index 390f9207900cec3ec6025873b53ac4b60a0fd7b8..9cfc06729b0911ceb1603425d9d811b875e29bb1 100644
--- a/src/threads.h
+++ b/src/threads.h
@@ -1,5 +1,5 @@
 /*
- * $Id: threads.h,v 1.105 2000/10/26 01:34:51 hubbe Exp $
+ * $Id: threads.h,v 1.106 2000/12/01 01:15:03 hubbe Exp $
  */
 #ifndef THREADS_H
 #define THREADS_H
@@ -692,6 +692,7 @@ HANDLE CheckValidHandle(HANDLE h);
 
 extern int threads_disabled;
 extern ptrdiff_t thread_storage_offset;
+extern struct program *thread_id_prog;
 
 #ifndef NO_PIKE_SHORTHAND
 #define MUTEX_T PIKE_MUTEX_T