From: Dmitry Bely <dbely@mail.ru>
To: "Mattias Waldau" <mattias.waldau@abc.se>
Cc: "'Dmitry Bely'" <dbely@mail.ru>, <caml-list@inria.fr>
Subject: Re: [Caml-list] Looking for sample DLL
Date: Sun, 21 Jul 2002 12:12:34 +0400 [thread overview]
Message-ID: <4retjy8d.fsf@mail.ru> (raw)
In-Reply-To: <006401c22f69$95484c10$0700a8c0@gateway> ("Mattias Waldau"'s message of "Fri, 19 Jul 2002 23:16:43 +0200")
"Mattias Waldau" <mattias.waldau@abc.se> 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
next prev parent reply other threads:[~2002-07-21 8:15 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-07-18 8:47 [Caml-list] ocamldot on steroids Brian Naylor
2002-07-18 8:54 ` Maxence Guesdon
2002-07-18 14:45 ` [Caml-list] Looking for sample DLL Mattias Waldau
2002-07-19 3:53 ` Dmitry Bely
2002-07-19 6:10 ` Mattias Waldau
2002-07-19 20:17 ` Dmitry Bely
2002-07-19 21:16 ` Mattias Waldau
2002-07-21 8:12 ` Dmitry Bely [this message]
2002-07-18 17:02 ` [Caml-list] ocamldot on steroids Brian Naylor
2002-07-18 18:45 ` Emmanuel Renieris
2002-07-19 8:39 ` Maxence Guesdon
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4retjy8d.fsf@mail.ru \
--to=dbely@mail.ru \
--cc=caml-list@inria.fr \
--cc=mattias.waldau@abc.se \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox