Re: Help with nlffi
brian <briand-/[email protected]>
| Newsgroups | gmane.comp.lang.sml.smlnj |
|---|---|
| Message-ID | <[email protected]> |
Hi Natalia, I highly recommend you use the math example which is in the sml source tree. It's a very good example to start with. To access your "something" you just need to do : F_something.f() I also recommend compiling foo.c to a dynamic library and use dynamic loading. Dynamic loading is really the best way to take advantage of nlffi. A simple example should not be too many files, you could just post the source code for more help. Brian On Apr 6, 2006, at 3:06 PM, Natalia Beatriz Bidart wrote: > Hi, > > After following step by step the README placed on $SMLNJ_HOME/src/ > ml-nlffigen, I can't make the example work :-(. > > I've just coded a really dummy foo.h (which uses no library at > all), and when running "sml -m foo.cm" I got the following: > > bn@DALI:~/tesis/nlffi-tests/example$ sml -m foo.cm > Standard ML of New Jersey v110.58 [built: Fri Mar 24 12:51:04 2006] > [scanning foo.cm] > [scanning $/c.cm] > foo.cm:4.13-5.6 Error: Io: openIn failed on "$Undef<c.cm>/c.cm", No > such file or directory > [attempting to load plugin $/make-tool.cm] > [library $/make-tool.cm is stable] > [library $smlnj/internal/cm-lib.cm is stable] > [library $smlnj/internal/srcpath-lib.cm is stable] > [library $SMLNJ-LIB/Util/smlnj-lib.cm is stable] > [library $SMLNJ-BASIS/basis.cm is stable] > $Execute: required privileges are: > cm-init > [library $smlnj/cm/cm.cm is stable] > [library $smlnj/internal/cm-sig-lib.cm is stable] > [library $/pgraph.cm is stable] > [library $smlnj/internal/cm0.cm is stable] > [library $smlnj/cm/tools.cm is stable] > [plugin $/make-tool.cm loaded successfully] > [make -f foo.make SMLNJ_BINDIR=/usr/local/sml/bin FFI/foo.cm] > make: `FFI/foo.cm' is up to date. > - > > My foo.h has only the following line: > > int something(void); > > After the automatic generation done with ml-nlffigen, I've got an > structure F_something with an 'f' function defined. > > I'm not sure if above ml's output is failing or not, but I've tried > to invoke F_something.f in the interpreter and I get: > - F_structure.f(); > stdIn:1.1-1.14 Error: unbound structure: F_structure in path > F_structure.f > > Can any of you please clarify how do I have to call the generated > code? > > Thanks, Natalia. > > > ------------------------------------------------------- > This SF.Net email is sponsored by xPML, a groundbreaking scripting > language > that extends applications into web and mobile media. Attend the > live webcast > and join the prime developer group breaking into this new coding > territory! > http://sel.as-us.falkag.net/sel? > cmd=lnk&kid=110944&bid=241720&dat=121642 > _______________________________________________ > Smlnj-list mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/smlnj-list ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642