Code Comments
Programming Forum and web based access to our favorite programming groups.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?
Post Follow-up to this messageHans 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?
Post Follow-up to this message> 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?
Post Follow-up to this messageHans 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 extensio n that declares a module. David
Post Follow-up to this messageHans 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.
Post Follow-up to this message> 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
Post Follow-up to this messageDavid 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!
Post Follow-up to this messagePowered by vBulletin
Copyright 2000-2006 Jelsoft Enterprises Limited.