Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

help? native extension mzscheme --> collection
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?







Report this thread to moderator Post Follow-up to this message
Old Post
Hans Oesterholt-Dijkema
11-09-04 01:56 PM


Re: help? native extension mzscheme --> collection
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?



Report this thread to moderator Post Follow-up to this message
Old Post
MJ Ray
11-10-04 01:56 AM


Re: help? native extension mzscheme --> collection
> 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?



Report this thread to moderator Post Follow-up to this message
Old Post
Hans Oesterholt-Dijkema
11-10-04 01:56 AM


Re: help? native extension mzscheme --> collection
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 extensio
n
that declares a module.

David

Report this thread to moderator Post Follow-up to this message
Old Post
David Van Horn
11-10-04 01:56 AM


Re: help? native extension mzscheme --> collection
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.



Report this thread to moderator Post Follow-up to this message
Old Post
MJ Ray
11-10-04 01:57 AM


Re: help? native extension mzscheme --> collection
> 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


Report this thread to moderator Post Follow-up to this message
Old Post
Hans Oesterholt-Dijkema
11-10-04 09:00 PM


Re: help? native extension mzscheme --> collection
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!

Report this thread to moderator Post Follow-up to this message
Old Post
Eli Barzilay
11-11-04 08:57 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Scheme archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:39 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.