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 OAA17946; Wed, 16 May 2001 14:31:33 +0200 (MET DST) 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 OAA17927 for ; Wed, 16 May 2001 14:31:32 +0200 (MET DST) Received: from relay.rinet.ru (relay.rinet.ru [195.54.192.35]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id f4GCVUn15556 for ; Wed, 16 May 2001 14:31:31 +0200 (MET DST) Received: (from uucp@localhost) by relay.rinet.ru (8.9.3/8.9.3) with UUCP id QAA07321 for caml-list@inria.fr; Wed, 16 May 2001 16:31:24 +0400 (MSD) X-Envelope-To: caml-list@inria.fr Received: from dialin1.stormoff (DIMA) [192.168.0.129] by stormoff with esmtp (Exim 2.05 #1 (Debian)) id 14zzEW-0000YA-00; Wed, 16 May 2001 15:12:48 +0400 To: caml-list@inria.fr Subject: [Caml-list] ocamlopt and Windows DLL From: Dmitry Bely Date: 16 May 2001 15:16:08 +0400 Message-ID: User-Agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Crater Lake) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk I am trying to build COM component written in ocaml using ocamlopt compiler. To achive that I have slightly modified camlidldll script from camlidl distribution. Now it builds DLL without a problem, but resulting DLL never executes "let _ = ..." (_*_entry) constructs! After a short investigation I have found the following code that seems to be causing the problem: [--- cfactory.cpp ---] /* DLL entry point */ BOOL APIENTRY DllMain(HANDLE module, DWORD reason, void *reserved) { char * argv[1]; switch(reason) { case DLL_PROCESS_ATTACH: argv[0] = NULL; camlidl_module_handle = (HMODULE) module; #if 0 int fd = open("d:\\work\\camllog", O_RDWR|O_TRUNC|O_CREAT, _S_IWRITE|_S_IREAD); dup2(fd, 1); dup2(fd, 2); close(fd); #endif caml_startup(argv); break; /* TODO: free all memory when DLL detached */ } return TRUE; } [--- cfactory.cpp ---] caml_startup() is called here with the empty argv list (no surprise, that's DLL). Manual says that this is not acceptable for proper initialization of the caml runtime library. Does this mean that it's absolutely impossible to build DLL using ocamlopt? Maybe there is a workaround? Hope to hear from you soon, Dmitry ------------------- To unsubscribe, mail caml-list-request@inria.fr. Archives: http://caml.inria.fr