caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] best way to implement c/c++ FFI for ocaml ?
@ 2004-09-10  4:41 briand
  2004-09-10  7:04 ` Brandon J. Van Every
  2004-09-10  8:54 ` Richard Jones
  0 siblings, 2 replies; 3+ messages in thread
From: briand @ 2004-09-10  4:41 UTC (permalink / raw)
  To: caml-list


I was wondering if someone could give me some advice on the best way
to approach writing ffi's to c or c++ code in ocaml.

I looked at the camlidl, but I can't tell if it's more specifically
for windows.

Is the swig implementation for ocaml in useful shape ?

Any other comments or advice ?

thanks

brian

-------------------
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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [Caml-list] best way to implement c/c++ FFI for ocaml ?
  2004-09-10  4:41 [Caml-list] best way to implement c/c++ FFI for ocaml ? briand
@ 2004-09-10  7:04 ` Brandon J. Van Every
  2004-09-10  8:54 ` Richard Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Brandon J. Van Every @ 2004-09-10  7:04 UTC (permalink / raw)
  To: caml-list

Brian wrote:
>
> Is the swig implementation for ocaml in useful shape ?

As of April 2004, the OCaml support in SWIG http://www.swig.org was only
being used by the author of said support.
http://mailman.cs.uchicago.edu/pipermail/swig/2004-April/009508.html

I have not followed up on it since then, but I keep almost finding a
reason to do so.  My interest is tied to the issue of Ocaml-ifying the
Nebula2 3D engine, http://nebuladevice.cubik.org .  It is a C++ engine
so this is a big job.


Cheers,                         www.indiegamedesign.com
Brand*n Van Every               S*attle, WA

Praise Be to the caml-list Bayesian filter! It blesseth
my postings, it is evil crap!  evil crap!  Bigarray!
Unboxed overhead group!  Wondering!  chant chant chant...

Is my technical content showing?

// return an array of 100 packed tuples
temps
  int $[tvar0][2*100]; // what the c function needs
  value $[tvar1]; // one int
  value $[tvar2]; // one tuple
  int $[tvar3] // loop control var
oncePre
eachPre
  $[cvar0]=&($[tvar0][0]);
eachPost
  $[lvar0] = alloc(2*100, 0 /*NB: zero-tagged block*/ );
  for(int $[tvar3]=0;$[tvar3]<100;$[tvar3]++) {
    $[tvar2] = alloc_tuple(2);
    $[tvar1] = Val_int($[cvar0][0+2*$[tvar3]]);
    Store_field($[tvar2],0,$[tvar1]);
    $[tvar1] = Val_int($[cvar0][1]);
    Store_field($[tvar2],1,$[tvar1+2*$[tvar3]]);
    Array_store($[lvar0],$[tvar3],$[tvar0]);
  }
oncePost

-------------------
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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] best way to implement c/c++ FFI for ocaml ?
  2004-09-10  4:41 [Caml-list] best way to implement c/c++ FFI for ocaml ? briand
  2004-09-10  7:04 ` Brandon J. Van Every
@ 2004-09-10  8:54 ` Richard Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Jones @ 2004-09-10  8:54 UTC (permalink / raw)
  Cc: caml-list

[-- Attachment #1: Type: text/plain, Size: 915 bytes --]

On Thu, Sep 09, 2004 at 09:41:33PM -0700, briand@aracnet.com wrote:
> 
> I was wondering if someone could give me some advice on the best way
> to approach writing ffi's to c or c++ code in ocaml.
> 
> I looked at the camlidl, but I can't tell if it's more specifically
> for windows.
> 
> Is the swig implementation for ocaml in useful shape ?
> 
> Any other comments or advice ?

Writing the interface by hand is simple enough.  Depends, of course,
on the platform you are using and the nature and extent of the C or
C++ library you want to interface with.

http://caml.inria.fr/ocaml/htmlman/manual032.html

Rich.

-- 
Richard Jones. http://www.annexia.org/ http://www.j-london.com/
Merjis Ltd. http://www.merjis.com/ - improving website return on investment
MOD_CAML lets you run type-safe Objective CAML programs inside the Apache
webserver. http://www.merjis.com/developers/mod_caml/

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2004-09-10  8:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-09-10  4:41 [Caml-list] best way to implement c/c++ FFI for ocaml ? briand
2004-09-10  7:04 ` Brandon J. Van Every
2004-09-10  8:54 ` Richard Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).