| Author |
help? native extension mzscheme --> collection
|
|
| Hans Oesterholt-Dijkema 2004-11-09, 8:56 am |
| Anyone,
I've a file 'ext.c', that I can compile using:
mzc --cc ext.c
mzc --ld ext.dll ext.obj
And use in a scheme prg:
(load-extension "ext.dll")
(extfunc 2 3 4)
--
But how can I do this?
(module tst mzscheme
;;(require ext)
(define (test)
(extfunc 2 3 4))
(test))
mzc --exe tst.exe tst.scm
MzScheme compiler (mzc) version 208, Copyright (c) 2004 PLT Scheme, Inc.
require: unknown module: ext
How can I make the ext.c file into a library module
that can be used by mzscheme?
Anyone?
| |
| MJ Ray 2004-11-09, 8:56 pm |
| Hans Oesterholt-Dijkema <hdnews@gawab.com> wrote:
> How can I make the ext.c file into a library module
> that can be used by mzscheme?
I don't really know. The plt-scheme list would be a better place to ask.
I have a compiled module which ended up in
$PLTHOME/collects/postgres/compiled/native/i386-linux/postgres.so
and I don't know if it's the path you're missing?
| |
| Hans Oesterholt-Dijkema 2004-11-09, 8:56 pm |
| > I don't really know. The plt-scheme list would be a better place to ask.
> I have a compiled module which ended up in
> $PLTHOME/collects/postgres/compiled/native/i386-linux/postgres.so
> and I don't know if it's the path you're missing?
Do you have a sample for this? Or the makefile used
or anything?
| |
| David Van Horn 2004-11-09, 8:56 pm |
| Hans Oesterholt-Dijkema wrote:
> I've a file 'ext.c', that I can compile using:
>
> mzc --cc ext.c
> mzc --ld ext.dll ext.obj
>
> And use in a scheme prg:
>
> (load-extension "ext.dll")
> (extfunc 2 3 4)
>
> --
> But how can I do this?
>
> (module tst mzscheme
>
> ;;(require ext)
>
> (define (test)
> (extfunc 2 3 4))
>
> (test))
>
> mzc --exe tst.exe tst.scm
> MzScheme compiler (mzc) version 208, Copyright (c) 2004 PLT Scheme, Inc.
> require: unknown module: ext
>
> How can I make the ext.c file into a library module
> that can be used by mzscheme?
The file ext.c needs to declare a module, and you should place the dll in a
compiled directory of a collection, eg
$PLTHOME/collects/ext/compiled/native/[platform]/ (I forget what the value of
platform should be for a Windows machine). After that, you can do:
(module tst mzscheme
(require (lib "ext.ss" "ext"))
(define (test)
(extfunc 2 3 4))
(test))
See $PLTHOME/collects/mzscheme/examples/idmodule.c for an example C extension
that declares a module.
David
| |
| MJ Ray 2004-11-09, 8:57 pm |
| Hans Oesterholt-Dijkema <hdnews@gawab.com> wrote:
> Do you have a sample for this? Or the makefile used
> or anything?
Looking further, that was from the src/libs directory on the CVS of
http://schematics.sf.net/ - not my code and I don't remember how it
works right now. I hope it is some help to you.
| |
| Hans Oesterholt-Dijkema 2004-11-10, 4:00 pm |
| > The file ext.c needs to declare a module, and you should place the dll
> in a compiled directory of a collection, eg
> $PLTHOME/collects/ext/compiled/native/[platform]/ (I forget what the
> value of platform should be for a Windows machine). After that, you can
> do:
>
> (module tst mzscheme
> (require (lib "ext.ss" "ext"))
> (define (test)
> (extfunc 2 3 4))
> (test))
Thanks for your answer. It worked, but not for mzc --exe tst tst.scm.
I had to "fall back to" mzc -z tst.scm.
--
Hans
| |
| Eli Barzilay 2004-11-11, 3:57 am |
| David Van Horn <dvanhorn@cs.uvm.edu> writes:
> The file ext.c needs to declare a module, and you should place the dll in a
> compiled directory of a collection, eg
> $PLTHOME/collects/ext/compiled/native/[platform]/ (I forget what the value of
> platform should be for a Windows machine).
Substitute "[platform]" with the value of `(system-library-subpath)',
which is made of two parts on Windows (for historic reasons).
--
((lambda (x) (x x)) (lambda (x) (x x))) Eli Barzilay:
http://www.barzilay.org/ Maze is Life!
|
|
|
|