From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id KAA02788; Wed, 7 Jan 2004 10:01:04 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA02157 for ; Wed, 7 Jan 2004 10:01:03 +0100 (MET) Received: from demos.bsdclusters.com (demos.bsdclusters.com [69.55.225.36]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id i07912502509 for ; Wed, 7 Jan 2004 10:01:02 +0100 (MET) Received: from demos.bsdclusters.com (demos [69.55.225.36]) by demos.bsdclusters.com (8.12.8p1/8.12.8) with ESMTP id i07910V0048001 for ; Wed, 7 Jan 2004 01:01:00 -0800 (PST) (envelope-from kmacy@fsmware.com) Received: from localhost (kmacy@localhost) by demos.bsdclusters.com (8.12.8p1/8.12.8/Submit) with ESMTP id i07910m5047991 for ; Wed, 7 Jan 2004 01:01:00 -0800 (PST) X-Authentication-Warning: demos.bsdclusters.com: kmacy owned process doing -bs Date: Wed, 7 Jan 2004 01:01:00 -0800 (PST) From: Kip Macy X-X-Sender: kmacy@demos.bsdclusters.com To: caml-list@inria.fr Subject: [Caml-list] adding an ocaml interpreter to my C program Message-ID: <20040107005029.V39150@demos.bsdclusters.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Loop: caml-list@inria.fr X-Spam: no; 0.00; kip:99 argc:01 char:01 argv:01 gdb:01 alloc:01 gdb:01 flags:01 argc:01 argv:01 char:01 bindings:01 ocaml:01 ocaml:01 null:01 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk It is possible to add many scripting languages as configuration languages for an arbitrary C program. One can transfer control to the interpreter, let it use the C bindings to modify program state, and then get control back. I'll give perl as an example: void sourceperl(int argc, char **argv) { PerlInterpreter gdb_perl = perl_alloc(); perl_construct(gdb_perl); PL_exit_flags |= PERL_EXIT_DESTRUCT_END; perl_parse(gdb_perl, NULL, argc, argv, (char **)NULL); perl_run(gdb_perl); perl_destruct(gdb_perl); } I don't see any obvious way of doing this with ocaml. I could link in GDB to the toplevel and use the toplevel as a frontend, but that isn't what I'm interested in doing. I'm using perl as a powerful macro language for gdb by just doing: (gdb) sourceperl mycoreanalyser.pl I'd like to also be able to support: (gdb) sourceocaml mycoranalyser.ml Is there any way for me to do this? Thanks. -Kip ------------------- 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