From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.6.10/8.6.6) id NAA24907 for caml-redistribution; Tue, 24 Sep 1996 13:52:00 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.6.10/8.6.6) with ESMTP id RAA07626 for ; Mon, 23 Sep 1996 17:12:49 +0200 Received: from news2.tokyo.intervia.ad.jp (news2.tokyo.intervia.ad.jp [202.235.64.84]) by concorde.inria.fr (8.7.6/8.7.1) with SMTP id RAA24547 for ; Mon, 23 Sep 1996 17:12:25 +0200 (MET DST) Received: from sparc1.nextsolution.co.jp (sparc1.nextsolution.co.jp [202.235.80.1]) by news2.tokyo.intervia.ad.jp (8.6.12+2.4W/intervia-1.7u) with SMTP id AAA05809 for ; Tue, 24 Sep 1996 00:11:57 +0900 Received: from sparc3.nextsolution.co.jp by sparc1.nextsolution.co.jp (5.x/SMI-SVR4) id AA03336; Tue, 24 Sep 1996 00:09:38 +0900 Received: by sparc3.nextsolution.co.jp (5.x/SMI-SVR4) id AA03139; Tue, 24 Sep 1996 00:09:43 +0900 Date: Tue, 24 Sep 1996 00:09:43 +0900 Message-Id: <9609231509.AA03139@sparc3.nextsolution.co.jp> From: Frank Christoph To: caml-list@pauillac.inria.fr Subject: Need help: O'Caml C Interface Sender: weis I have a C function void getCharWidth(int code, double *x, double *y); which returns its values in the two pointer arguments. I tried to write a stub function that creates a 2-tuple and passes it back: external width : int -> float * float = "ocaml_getCharWidth" via: value ocaml_getCharWidth(value code) { double x, y; Push_roots(r,1); r[0] = alloc_tuple(2); getCharWidth(Int_val(code),&x,&y); Store_double_val(Field(r[0],0),x); Store_double_val(Field(r[0],1),y); Pop_roots(); return r[0]; } where I used Store_double_val because, as far as I can see, there is no "Val_double" macro. However, this gives me a segmentation fault. I'm not really sure I understand how the *_roots functions work. Do the two local variables x and y need to be declared as of type value? If so, how can I pass them to getCharWidth (since Double_val doesn't return an lvalue)? What am I doing wrong? ------------------------------------------------------------------------ Frank Christoph Next Solution Co. Tel: 0424-98-1811 christo@nextsolution.co.jp Fax: 0424-98-1500