caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Dmitry Bely <dbely@mail.ru>
To: caml-list@inria.fr
Subject: [Caml-list] ocamlopt and Windows DLL
Date: 16 May 2001 15:16:08 +0400	[thread overview]
Message-ID: <sni5r1c7.fsf@mail.ru> (raw)

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


             reply	other threads:[~2001-05-16 12:31 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-05-16 11:16 Dmitry Bely [this message]
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

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=sni5r1c7.fsf@mail.ru \
    --to=dbely@mail.ru \
    --cc=caml-list@inria.fr \
    /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;
as well as URLs for NNTP newsgroup(s).