English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

Browse thread
[Caml-list] ocamlopt and Windows DLL
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2001-05-16 (12:31)
From: Dmitry Bely <dbely@m...>
Subject: [Caml-list] ocamlopt and Windows DLL
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

[--- cfactory.cpp ---]
/* DLL entry point */

BOOL APIENTRY DllMain(HANDLE module, DWORD reason, void *reserved)
  char * argv[1];

  switch(reason) {
    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);
  /* 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,

To unsubscribe, mail caml-list-request@inria.fr.  Archives: http://caml.inria.fr