[Larceny-users] library form for gl.scm

Eduardo Cavazos wayo.cavazos at gmail.com
Thu Feb 5 12:20:10 EST 2009


Success!

This test case library works. I put it in 'lib' and named it 
'gl-test.sls'. Also note, I had to add a '(primitives ...)' form to the 
import clause to get it to work.

I'm able to load it like so:

~ # larceny -err5rs
Larceny v0.97b1 (beta test) (Aug 25 2008 07:06:36, precise:Linux:unified)
larceny.heap, built on Mon Aug 25 07:08:14 EDT 2008
ERR5RS mode (no libraries have been imported)

 > (import (rnrs) (gl-test))

The contents of 'gl-test.sls' are below. If this looks good, I'll model 
the full 'gl.sls' on it.

----------------------------------------------------------------------
(library

  (gl-test)

  (export GL_TRUE glBegin)

  (import (rnrs base)
  	 (rnrs io simple)
  	 (err5rs records syntactic)
	
	 (primitives foreign-file
		     foreign-procedure))

  (define libGL (foreign-file "libGL.so.1"))

  (define GL_TRUE #x1)

  (define-syntax define-function
    (syntax-rules ()
      ((_ ret name args)
       (define name (foreign-procedure (symbol->string 'name) 'args 
'ret)))))

  (define-function void glBegin (int))

  )
----------------------------------------------------------------------





More information about the Larceny-users mailing list