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 KAA30052; Sun, 21 Jul 2002 10:15:21 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id KAA30055 for ; Sun, 21 Jul 2002 10:15:20 +0200 (MET DST) Received: from relay.rinet.ru (relay.rinet.ru [195.54.192.35]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id g6L8FJj20364 for ; Sun, 21 Jul 2002 10:15:19 +0200 (MET DST) Received: (from uucp@localhost) by relay.rinet.ru (8.11.6/8.11.6) with UUCP id g6L8FIG00706; Sun, 21 Jul 2002 12:15:18 +0400 (MSD) X-Envelope-To: caml-list@inria.fr Received: from dialin1.stormoff (ROVER1) [192.168.0.129] by stormoff with esmtp (Exim 3.12 #1 (Debian)) id 17WBpb-0003gV-00; Sun, 21 Jul 2002 12:12:44 +0400 X-Comment-To: "Mattias Waldau" To: "Mattias Waldau" Cc: "'Dmitry Bely'" , Subject: Re: [Caml-list] Looking for sample DLL References: <006401c22f69$95484c10$0700a8c0@gateway> From: Dmitry Bely Date: Sun, 21 Jul 2002 12:12:34 +0400 In-Reply-To: <006401c22f69$95484c10$0700a8c0@gateway> ("Mattias Waldau"'s message of "Fri, 19 Jul 2002 23:16:43 +0200") Message-ID: <4retjy8d.fsf@mail.ru> User-Agent: Gnus/5.090005 (Oort Gnus v0.05) XEmacs/21.4 (Common Lisp (Windows [3]), i586-pc-win32) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk "Mattias Waldau" writes: > The reason I was looking for a sample is that it will take me > probably a couple of days just getting the makefile right etc. > Therefor, much easier to just take someone else code and tweak > it a little. Well, look into camlidl runtime. In fact, all you need is extern "C" BOOL APIENTRY DllMain(HANDLE module, DWORD reason, void *reserved) { char * argv[2]; char dll_path[_MAX_PATH]; switch(reason) { case DLL_PROCESS_ATTACH: GetModuleFileName( (HMODULE) module, dll_path, _MAX_PATH ); argv[0] = dll_path; argv[1] = NULL; camlidl_module_handle = (HMODULE) module; #if 0 int fd = open("/tmp/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; } and an appropriate Makefile. You can also easily modify camlidldll script, removing all COM-related stuff from there. >> I cannot understand this. DLL and COM are not concepts of the >> same level. That's like to say "I prefer fruits to oranges" :-) > > COM's are implemented as a DLL, I have been unclear. What I need > is to be able using the old win16/32 dll-calling convention, not > using the modern COM-convention. > > The reason is that VBA doesn't support the COM supported by camlidl, > it only supports IDISPATCH. But once again, IDISPATCH is *supported* by camlidl. Why not to create IDispatch-equipped Ocaml COM component? > (I made some COM-stuff in my life, but > I do not like it, especially if you need to use C++. Now at last > in dotnet seems Microsoft gotten it right without wizards that > creates enormous amounts of code I don't understand.) For VB and OCaml, no wizard-generated code is necessary, just normal C stubs and virtual method tables plus type libraries, generated by MIDL. > I would like to keep it as simple as possible, thus the dll-calling > convention is enough. I will only call a few functions and I only > need to return integers. (Thus no need to mess with BSTR, which > would be needed if I would return strings from ocaml to vb). - Dmitry Bely ------------------- 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