caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] ocamlopt and Windows DLL
@ 2001-05-16 11:16 Dmitry Bely
  2001-05-18 19:51 ` [Caml-list] Obsessed by speed Mattias Waldau
  2001-05-22 17:10 ` [Caml-list] ocamlopt and Windows DLL Dmitry Bely
  0 siblings, 2 replies; 17+ messages in thread
From: Dmitry Bely @ 2001-05-16 11:16 UTC (permalink / raw)
  To: caml-list

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


^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2001-06-01 22:22 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-05-16 11:16 [Caml-list] ocamlopt and Windows DLL Dmitry Bely
2001-05-18 19:51 ` [Caml-list] Obsessed by speed Mattias Waldau
2001-05-21 16:44   ` Chris Hecker
2001-05-21 19:12   ` William Chesters
2001-05-27  8:47   ` Xavier Leroy
2001-05-31 15:13   ` [Caml-list] report describing optimization of numerical computing of the ocaml compiler Peter Ronnquist
2001-05-31 15:15   ` Peter Ronnquist
2001-05-31 16:12     ` Brian Rogoff
2001-06-01  2:30       ` [Caml-list] report describing optimization of numerical computingof " John Max Skaller
2001-06-01  4:10       ` [Caml-list] report describing optimization of numerical computing of " Tom _
2001-06-01  4:20         ` Niall Dalton
2001-06-01  6:33         ` [Caml-list] SISAL (Was: report describing optimization of numerical computing...) Florian Hars
2001-06-01 22:22           ` Tom _
2001-05-31 15:15   ` [Caml-list] report describing optimization of numerical computing of the ocaml compiler Peter Ronnquist
2001-05-22 17:10 ` [Caml-list] ocamlopt and Windows DLL Dmitry Bely
2001-05-28 14:53   ` Dmitry Bely
2001-05-28 15:29     ` Xavier Leroy

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).