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 PAA20983; Thu, 3 Jan 2002 15:34:14 +0100 (MET) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f 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 PAA21075 for ; Thu, 3 Jan 2002 15:34:13 +0100 (MET) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.11.1/8.11.1) with ESMTP id g03EYCb02359; Thu, 3 Jan 2002 15:34:12 +0100 (MET) Received: (from xleroy@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id PAA20828; Thu, 3 Jan 2002 15:34:12 +0100 (MET) Date: Thu, 3 Jan 2002 15:34:12 +0100 From: Xavier Leroy To: Warp Cc: OCaml Subject: Re: [Caml-list] Callback in DLL Message-ID: <20020103153412.A20919@pauillac.inria.fr> References: <12e101c18e3d$1eaa96d0$bdc20b50@warp> <20011228094910.A17635@pauillac.inria.fr> <004001c18f9e$e3f58e10$f7fdfdc1@warp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0i In-Reply-To: <004001c18f9e$e3f58e10$f7fdfdc1@warp>; from warplayer@free.fr on Fri, Dec 28, 2001 at 01:55:12PM +0100 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk > > If you're building a DLL whose purpose is to be loaded inside > > ocamlrun, then you should link with ocamlrun.lib, which is an "import > > library" around the DLL entry points exported by ocamlrun. > > 1) if I only link ocamlrun.lib, it can't find external "local_roots" needed > in CAMLparamX You probably forgot to compile your C code with the /MD flag (meaning "multithreaded DLL"). Explanation: the Win32 dynamic linker cannot cope with shared global variables, so these need to be accessed by calls to shared functions. The C compiler generates the calls provided the global variable is declared "dllimport". The Caml header files add the proper declaration provided the _DLL symbol is defined. The C compiler defines _DLL if it is invoked with the /MD flag. End of inference :-) > so I have to use my caml_init_func (dll entry point) and a modified > interpreter > which call the entry point passing the adress of local_roots. No you don't have to modify anything. Just read carefully the makefiles in the system sources and follow what's done there. > > Of course. You didn't tell it that you've kept a pointer to "v" in > > the window data. So, as far as the GC is concerned, nobody is > > pointing to "v", so it can be freed. > > Actually , "v" is returned to the caml, and then let-stored. So it is > referenced. All right, but the GC also moves live blocks around, so it really needs to know all the pointers to the block. - Xavier Leroy ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr