[plt-scheme] loading extension in a module

From: Daniel Silva (daniel.silva at gmail.com)
Date: Mon Nov 29 12:41:12 EST 2004

To write your C extension as a module, you create a module namespace
with scheme_primitive_module, then add your primitives to it, and
finally close the namespace with scheme_finish_primitive_module:

Scheme_Object* scheme_initialize(Scheme_Env* ns)
{
  Scheme_Env* ns = scheme_primitive_module(scheme_module_name(), enclosing_ns);
  scheme_add_global("c-lstat", my_c_lstat_primitive, ns);
  ...
  scheme_finish_primitive_module(ns);
  return scheme_void;
}


Daniel

On 29 Nov 2004 07:27:37 -0800, Ian Zimmerman <itz at buug.org> wrote:
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
> 
> Hi, I'm learning how to write a C extension.  The files are here:
> 
> http://primate.net/~itz/plt-posix/
> 
> The problem I'm running into is as follows:
> 
> Welcome to MzScheme version 208, Copyright (c) 2004 PLT Scheme, Inc.
> > (load-extension "plt_stat.so")
> > c-lstat
> #<primitive:c-lstat>
> > (c-lstat "plt_stat.so")
> 0
> 771
> 0
> 0
> 6308513
> 0
> 0
> 509
> 0
> 0
> 8
> 0
> 0
> 1
> 0
> 0
> 1000
> 0
> 0
> 1000
> 0
> 0
> 0
> 0
> 0
> 38673
> 0
> 0
> 28000149
> 1
> 0
> 28000077
> 1
> 0
> 28000077
> 1
> 0
> > (require "stat.ss")
> stat.ss:64:42: compile: unbound variable in module in: c-lstat
> >
> 
> What am I doing wrong?  TIA
> 
> --
> "It's not true or not."  A reality show producer (real quote)
>


Posted on the users mailing list.