[racket] Loading or Requiring a Module

From: Cody Eilar (cody.eilar at gmail.com)
Date: Tue Feb 11 13:30:19 EST 2014

Thanks Matthew,

   That's exactly what I am looking for!

~Cody


On Tue, Feb 11, 2014 at 5:47 AM, Matthew Flatt <mflatt at cs.utah.edu> wrote:

> You should create a collection to hold your module:
>
>
> http://docs.racket-lang.org/guide/module-basics.html#%28part._link-collection%29
>
> If you create "myCollection" and put "myModule_rkt.so" in
>
>  myCollection/compiled/native/x86_64/3m/
>
> then you'll be able to import it from anywhere using
>
>  (require myCollection/myModule)
>
>
>
> At Mon, 10 Feb 2014 11:20:15 -1000, Cody Eilar wrote:
> > Lately I have been using (require "myModule.rlt") to access some
> extensions
> > that I wrote in C. The caveat with this is that I have to put my
> extensions
> > in the "special" directory compiled/native/x86_64/3m. This will end up to
> > be a major problem because I need my extensions accessible from anywhere
> a
> > racket script is created on my machine.
> >
> > In other words, what I would like to do is something like this:
> >
> > (require "/path/to/myModule_rkt.so")
> >
> > Now, if I don't make my c extension a module, I can do something similar
> to
> > this using (load-extension) but then the problem becomes that I can't
> run a
> > script. I am able to load my extension successfully from the racket
> command
> > line, but if I run racket myscript.rtk, it doesn't recognize any of the
> > extension functions, let alone the extension.
> >
> > From what I have read so far here :
> >
> >
> http://docs.racket-lang.org/reference/eval.html#%28tech._compiled._load._handle
> > r%29
> >
> > The only way to do what I want would be to copy that compiled directory
> > around from project to project and that's a real bummer.
> >
> > Thanks for your help!
> > ____________________
> >   Racket Users list:
> >   http://lists.racket-lang.org/users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20140211/0c0e801d/attachment.html>

Posted on the users mailing list.