Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: skaller <skaller@users.sourceforge.net>
To: Max Powers <max_powers280@hotmail.com>
Cc: caml-list <caml-list@inria.fr>
Subject: Re: [Caml-list] Calling Ocaml from Python
Date: 29 Apr 2004 15:33:29 +1000	[thread overview]
Message-ID: <1083216808.9537.1289.camel@pelican.wigram> (raw)
In-Reply-To: <BAY9-F62flz4RZo09mp00016379@hotmail.com>

On Thu, 2004-04-29 at 15:07, Max Powers wrote:
> >On Thu, 2004-04-29 at 13:49, skaller wrote:
> >
> >There is an Ocaml module in SWIG which may be useful to you.
> 
> Hmmm, forgive me if I'm totally off base with this, but I thought that SWIG 
> was used to interface a C library to other languages.

Yes.

>  I.e. I can use SWIG to 
> generate an interface to a c library so I can use that from Ocaml, rather 
> than generating an interface to expose Ocaml functions to a C (or other) 
> program. 

You can write a C wrapper for an Ocaml function in C,
and then wrap THAT using SWIG so you can call it from Python.

Writing C that wraps a simple function like

	parse_file: string -> ast

should be easy: string is the filename, and ast is 
a magical pointer to the parse tree. The wrapper would
make it a root of the Caml gc. 

You can probably do that now. Of course you won't
be able to use 'ast' to do anything, but at least
you can check you can invoke the parser on either
side of the interface without a core dump :D

-- 
John Skaller, mailto:skaller@users.sf.net
voice: 061-2-9660-0850, 
snail: PO BOX 401 Glebe NSW 2037 Australia
Checkout the Felix programming language http://felix.sf.net



-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


  reply	other threads:[~2004-04-29  5:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-29  5:07 Max Powers
2004-04-29  5:33 ` skaller [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-04-30  1:13 Max Powers
2004-04-29  7:42 Max Powers
2004-04-29  5:58 Max Powers
2004-04-29  6:56 ` skaller
2004-04-29 21:24 ` art yerkes
2004-04-29  3:09 Max Powers
2004-04-29  3:49 ` skaller
2004-04-29  5:45 ` Basile STARYNKEVITCH
2004-04-29 14:16 ` John Goerzen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1083216808.9537.1289.camel@pelican.wigram \
    --to=skaller@users.sourceforge.net \
    --cc=caml-list@inria.fr \
    --cc=max_powers280@hotmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox