diff --git a/src/dmalloc.h b/src/dmalloc.h
index db1b8f6804396f7bfdde3a8554a854f41713a4f1..eef6793dc4ad1b8126a6f6b17818e0c61db41bf3 100644
--- a/src/dmalloc.h
+++ b/src/dmalloc.h
@@ -1,8 +1,12 @@
 /*
- * $Id: dmalloc.h,v 1.27 2000/09/02 23:11:27 mast Exp $
+ * $Id: dmalloc.h,v 1.28 2000/12/13 21:24:44 hubbe Exp $
  */
 
-extern char *debug_xalloc(size_t);
+PMOD_EXPORT extern char *debug_xalloc(size_t);
+PMOD_EXPORT extern void debug_xfree(void *);
+PMOD_EXPORT extern void *debug_xmalloc(size_t);
+PMOD_EXPORT extern void *debug_xcalloc(size_t,size_t);
+PMOD_EXPORT extern void *debug_xrealloc(void *,size_t);
 
 #define DMALLOC_LOCATION() ("S"  __FILE__ ":" DEFINETOSTR(__LINE__) )
 
@@ -54,6 +58,7 @@ char *dmalloc_find_name(void *p);
 #define debug_malloc_touch(X) debug_malloc_update_location((X),DMALLOC_LOCATION())
 #define debug_malloc_pass(X) debug_malloc_update_location((X),DMALLOC_LOCATION())
 #define xalloc(X) ((char *)debug_malloc_pass(debug_xalloc(X)))
+#define xfree(X) debug_xfree(debug_malloc_pass((X)))
 void debug_malloc_dump_references(void *x, int indent, int depth, int flags);
 #define dmalloc_touch(TYPE,X) ((TYPE)debug_malloc_update_location((X),DMALLOC_LOCATION()))
 #define dmalloc_touch_svalue(X) do { struct svalue *_tmp = (X); if ((X)->type <= MAX_REF_TYPE) { debug_malloc_touch(_tmp->u.refs); } } while(0)
@@ -94,6 +99,17 @@ int dmalloc_is_invalid_memory_block(void *block);
 #define DMALLOC_PROXY_ARGS
 #define debug_malloc_dump_references(X,x,y,z)
 #define xalloc debug_xalloc
+#if defined(DYNAMIC_MODULE) && defined(__NT__)
+#define xmalloc debug_xmalloc
+#define xcalloc debug_xcalloc
+#define xrealloc debug_xrealloc
+#define xfree debug_xfree
+#else
+#define xmalloc malloc
+#define xcalloc calloc
+#define xrealloc realloc
+#define xfree free
+#endif
 #define dbm_main main
 #define DO_IF_DMALLOC(X)
 #define debug_malloc_update_location(X,Y) (X)
diff --git a/src/pike_memory.c b/src/pike_memory.c
index 78717a31ee17bb93e043c38dc44e229fc7e5b3eb..cbc5308050b075fdaf994760e60d58b4129e652f 100644
--- a/src/pike_memory.c
+++ b/src/pike_memory.c
@@ -10,7 +10,7 @@
 #include "pike_macros.h"
 #include "gc.h"
 
-RCSID("$Id: pike_memory.c,v 1.95 2000/12/01 20:42:10 grubba Exp $");
+RCSID("$Id: pike_memory.c,v 1.96 2000/12/13 21:31:52 hubbe Exp $");
 
 /* strdup() is used by several modules, so let's provide it */
 #ifndef HAVE_STRDUP
@@ -566,13 +566,6 @@ PMOD_EXPORT char *debug_xalloc(size_t size)
   if(!size) 
      Pike_error("Allocating zero bytes.\n");
 
-#ifdef SOFTLIM
-  if(softlim_should_be)
-  {
-    
-  }
-
-#endif
 
   ret=(char *)malloc(size);
   if(ret) return ret;
@@ -581,6 +574,26 @@ PMOD_EXPORT char *debug_xalloc(size_t size)
   return 0;
 }
 
+PMOD_EXPORT void debug_xfree(void *mem)
+{
+  free(mem);
+}
+
+PMOD_EXPORT void *debug_xmalloc(size_t s)
+{
+  return malloc(s);
+}
+
+PMOD_EXPORT void *debug_xrealloc(void *m, size_t s)
+{
+  return realloc(m,s);
+}
+
+PMOD_EXPORT void *debug_xcalloc(size_t n, size_t s)
+{
+  return calloc(n,s);
+}
+
 char *debug_qalloc(size_t size)
 {
   char *ret;
@@ -720,14 +733,14 @@ void *fake_malloc(size_t x)
   return 0;
 }
 
-void *malloc(size_t x)
+PMOD_EXPORT void *malloc(size_t x)
 {
   if(!x) return 0;
   if(real_malloc) return debug_malloc(x,DMALLOC_LOCATION());
   return fake_malloc(x);
 }
 
-void fake_free(void *x)
+PMOD_EXPORT void fake_free(void *x)
 {
   struct fakemallocblock * block;
 
@@ -742,7 +755,7 @@ void fake_free(void *x)
   }
 }
 
-void free(void *x)
+PMOD_EXPORT void free(void *x)
 {
   struct fakemallocblock * block;
 
@@ -757,7 +770,7 @@ void free(void *x)
   }
 }
 
-void *realloc(void *x,size_t y)
+PMOD_EXPORT void *realloc(void *x,size_t y)
 {
   void *ret;
   size_t old_size;
diff --git a/src/pike_memory.h b/src/pike_memory.h
index 6e87ed49d6016f8ea6810cdfbe52f994ff25de27..f9b8666f86ff05479731bbd888de29e4960b9074 100644
--- a/src/pike_memory.h
+++ b/src/pike_memory.h
@@ -5,7 +5,7 @@
 \*/
 
 /*
- * $Id: pike_memory.h,v 1.28 2000/12/01 20:51:16 grubba Exp $
+ * $Id: pike_memory.h,v 1.29 2000/12/13 21:31:53 hubbe Exp $
  */
 #ifndef MEMORY_H
 #define MEMORY_H
@@ -109,6 +109,10 @@ PMOD_EXPORT void memfill(char *to,
 	     INT32 fromlen,
 	     INT32 offset);
 PMOD_EXPORT char *debug_xalloc(size_t size);
+PMOD_EXPORT void *debug_xmalloc(size_t s);
+PMOD_EXPORT void debug_xfree(void *mem);
+PMOD_EXPORT void *debug_xrealloc(void *m, size_t s);
+PMOD_EXPORT void *debug_xcalloc(size_t n, size_t s);
 
 #undef BLOCK_ALLOC