diff --git a/src/code/ia32.c b/src/code/ia32.c
index 16d1c9f90b5066972ffbb83662cda4ed93fd894e..af00e5a5bfa49da76385c4526fd29a4710d9b015 100644
--- a/src/code/ia32.c
+++ b/src/code/ia32.c
@@ -1,5 +1,5 @@
 /*
- * $Id: ia32.c,v 1.13 2001/07/27 08:32:03 hubbe Exp $
+ * $Id: ia32.c,v 1.14 2001/08/02 22:24:54 hubbe Exp $
  *
  * Machine code generator for IA32.
  *
@@ -412,12 +412,21 @@ void ins_f_byte_with_arg(unsigned int a,unsigned INT32 b)
       }
       break;
 
+      /*
+       * And this would work nicely for all non-dynamically loaded
+       * functions. Unfortunately there is no way to know if it is
+       * dynamically loaded or not at this point...
+       */
     case F_MARK_CALL_BUILTIN:
+      if(Pike_compiler->new_program->constants[b].sval.u.efun->internal_flags & CALLABLE_DYNAMIC)
+	break;
       update_arg1(0);
       ia32_call_c_function(Pike_compiler->new_program->constants[b].sval.u.efun->function);
       return;
 
     case F_CALL_BUILTIN1:
+      if(Pike_compiler->new_program->constants[b].sval.u.efun->internal_flags & CALLABLE_DYNAMIC)
+	break;
       update_arg1(1);
       ia32_call_c_function(Pike_compiler->new_program->constants[b].sval.u.efun->function);
       return;
diff --git a/src/constants.c b/src/constants.c
index d076dc15e92b376e61215fcefb6a03bdfd4b97e8..1536e195e777286f7140bb1a57465176421ce5bf 100644
--- a/src/constants.c
+++ b/src/constants.c
@@ -17,7 +17,7 @@
 #include "security.h"
 #include "block_alloc.h"
 
-RCSID("$Id: constants.c,v 1.31 2001/07/02 04:09:47 hubbe Exp $");
+RCSID("$Id: constants.c,v 1.32 2001/08/02 22:24:53 hubbe Exp $");
 
 struct mapping *builtin_constants = 0;
 
@@ -74,6 +74,8 @@ PMOD_EXPORT void add_global_program(char *name, struct program *p)
 }while(0)
 BLOCK_ALLOC(callable,128)
 
+int global_callable_flags=0;
+
 /* Eats one ref to 'type' and 'name' */
 PMOD_EXPORT struct callable *low_make_callable(c_fun fun,
 				   struct pike_string *name,
@@ -90,6 +92,7 @@ PMOD_EXPORT struct callable *low_make_callable(c_fun fun,
   f->flags=flags;
   f->docode=docode;
   f->optimize=optimize;
+  f->internal_flags = global_callable_flags;
 #ifdef PIKE_DEBUG
   {
     struct pike_type *z = check_call(function_type_string, type, 0);
diff --git a/src/constants.h b/src/constants.h
index fffa9b3108093ca3423e060d9d798ba4783a0d85..624cc28a7c844bf64d6ff24629a6ab1885b083c7 100644
--- a/src/constants.h
+++ b/src/constants.h
@@ -5,7 +5,7 @@
 \*/
 
 /*
- * $Id: constants.h,v 1.18 2001/07/02 04:09:47 hubbe Exp $
+ * $Id: constants.h,v 1.19 2001/08/02 22:24:54 hubbe Exp $
  */
 #ifndef ADD_EFUN_H
 #define ADD_EFUN_H
@@ -18,13 +18,16 @@
 typedef int (*docode_fun)(node *n);
 typedef node *(*optimize_fun)(node *n);
 
+#define CALLABLE_DYNAMIC 1
+
 struct callable
 {
   PIKE_MEMORY_OBJECT_MEMBERS;
   c_fun function;
   struct pike_type *type;
   struct pike_string *name;
-  INT16 flags;
+  INT16 flags; /* OPT_* */
+  INT16 internal_flags;
 #ifdef PIKE_DEBUG
   INT8 may_return_void;
   long compiles;
diff --git a/src/dynamic_load.c b/src/dynamic_load.c
index e29f11562ebea77aed9a3f387a5c63f4e5314284..722146a7969350adde661f38226cffdc4e5d94bf 100644
--- a/src/dynamic_load.c
+++ b/src/dynamic_load.c
@@ -7,8 +7,9 @@
 #  include "stralloc.h"
 #  include "pike_macros.h"
 #  include "main.h"
+#  include "constants.h"
 
-RCSID("$Id: dynamic_load.c,v 1.52 2001/03/28 15:07:38 grubba Exp $");
+RCSID("$Id: dynamic_load.c,v 1.53 2001/08/02 22:24:54 hubbe Exp $");
 
 #endif /* !TESTING */
 
@@ -341,6 +342,12 @@ void f_load_module(INT32 args)
   new_module->exit=exit;
 
   start_new_program();
+
+  {
+    extern int global_callable_flags;
+    global_callable_flags|=CALLABLE_DYNAMIC;
+  }
+
 #ifdef PIKE_DEBUG
   { struct svalue *save_sp=sp;
 #endif