From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr Delivered-To: caml-list@yquem.inria.fr Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by yquem.inria.fr (Postfix) with ESMTP id 29862BB81 for ; Wed, 22 Feb 2006 09:09:23 +0100 (CET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by nez-perce.inria.fr (8.13.0/8.13.0) with ESMTP id k1M89MR8003129 for ; Wed, 22 Feb 2006 09:09:22 +0100 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 JAA20507 for ; Wed, 22 Feb 2006 09:09:22 +0100 (MET) Received: from mxintern.schlund.de (mxintern.kundenserver.de [212.227.126.201]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k1M89LBt011025 for ; Wed, 22 Feb 2006 09:09:22 +0100 Received: from [172.17.36.11] (helo=schluck.use.schlund.de) by mxintern.kundenserver.de with esmtp (Exim 4.34) id 1FBp3p-0004mQ-Bd for caml-list@inria.fr; Wed, 22 Feb 2006 09:09:21 +0100 From: Michael Wohlwend To: caml-list@inria.fr Subject: c binding question Date: Wed, 22 Feb 2006 09:09:55 +0100 User-Agent: KMail/1.9.1 X-Face: S)[vu%Bha1d&ej9GfwAq~7C}A,y[B.uS}+D6'hb~xPwsxymw$fnCOaMe<=?utf-8?q?*bnUajSBR=5Fm=3FR=0A=09?=@V3;iX8[A}z`.%pEQ1r7iZhN8#ktTCBQ}&mkx>=RH&l|l6\]NZI@ MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline Message-Id: <200602220909.55592.micha-1@fantasymail.de> X-Virus-Scanned: Symantec AntiVirus Scan Engine X-Miltered: at nez-perce with ID 43FC1C32.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 43FC1C31.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; char:01 datatype:01 lib:01 char:01 abstract:01 parameter:02 variables:02 binding:02 string:02 string:02 allocated:03 allocated:03 finalize:04 interface:05 michael:08 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.1 required=5.0 tests=FORGED_RCVD_HELO autolearn=disabled version=3.0.3 Hi, I want to make an interface to a c-lib in which some function take a char* as a parameter and store this paramenter in their internal variables. I have done this this way: I copy the ocaml-string to a new c-string and I allocated a custom block to store the abstract datatype of the lib together with the allocated char* for that string. The finalize function of that custom block releases the allocated memory of the string and cleans up the rest... Is this the correct way to do this? thanks, Michael