Version française
Home     About     Download     Resources     Contact us    
Browse thread
Compiling pycaml shared library
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Grant Monroe <grant@j...>
Subject: Compiling pycaml shared library
Hello All,
I'm trying to figure out how to compile a simple shared library (.so)
using pycaml that I can load from the python interpreter. I have a
single .ml file who's contents are as follows:


open Pycaml

let foo_bar_print = pywrap_closure (fun x -> print_endline "hi" ; pynone ()) ;;
let sd = pyimport_getmoduledict () ;;
let mx = pymodule_new "CamlModule" ;;
let cd = pydict_new () ;;
let cx = pyclass_new (pynull (), cd, pystring_fromstring "CamlClass") ;;
let cmx = pymethod_new (foo_bar_print,(pynull ()),cx) ;;
let _ = pydict_setitemstring (cd, "CamlMethod", cmx) ;;
let _ = pydict_setitemstring (pymodule_getdict mx, "CamlClass", cx) ;;
let _ = pydict_setitemstring (sd, "CamlModule", mx) ;;


I'm new to ocaml so basically I want to know what commands to run with
which flags and what libraries need to be linked to and how. Any help
would be appreciated.

Grant Monroe
JanRain, Inc.

P.S. - I tried sending the project creator a message, but the email
address listed on the page seems to have expired.