Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
From: Matthieu Dubuget <matthieu.dubuget@laposte.net>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] caml_startup/caml_cleanup : problem with threads
Date: Fri, 17 Nov 2006 09:20:25 +0100	[thread overview]
Message-ID: <455D70C9.4070007@laposte.net> (raw)
In-Reply-To: <455C5370.5070603@laposte.net>

Matthieu Dubuget a écrit :
> - I experience this with B.dll only. Not A.dll. I'm going to narrow
>   the problem by removing functionnalities from B.dll step by
>   step. 
>
>   
OK. I have the problem as soon as my DLL uses Thread module.

What does caml_startup in this case?

Here is a minimal set of files allowing to produce a problematic DLL.
Do you think there is any problem with this code and the compilation
command lines?

demo.ml
---------------
|Callback.register "wait a moment" Thread.delay
---------------

bug_demo_st.c
---------------
|#include <caml/mlvalues.h>
|#include <caml/callback.h>
|
|static int demo_init_done = 0;
|
|void demo_init (){
|  char * argv[] = { "argv", NULL};
|
|  if (!demo_init_done) {
|    caml_startup (argv);
|    demo_init_done = 1;
|  }
|}
|
|int demo_init_ok (void){  return demo_init_done; }
---------------

bug_demo.def:
---------------
|EXPORTS
|demo_init
|demo_init_ok
---------------

And the compilations instructions I used (MinGW version)
---------------
|gcc -mno-cygwin -O -mms-bitfields -c -I"C:\Program Files\Objective
Caml\lib" "bug_demo_st.c"   
|     or simply:  ocamlopt -c bug_demo_st.c
|ocamlopt.opt -thread -output-obj -o demog.o unix.cmxa threads.cmxa demo.ml
|gcc -mno-cygwin -Wl,--kill-at -shared -o bug_demo.dll -L"C:\Program
Files\Objective Caml\lib" \
|             demog.o  bug_demo_st.o bug_demo.def  -lunix -lasmrun
-lwsock32 -lthreadsnat -lthreads
---------------

> - Why did I said that LabVIEW is not the problem?
>
>     - Because we reproduced the problem loading and unloadind B.dll in
>       Java.
>
>     - Because I experienced the problem another way: I did a little C
>       program that load/unload B.DLL and exits. This program was run
>       from an *eshell* emacs session. And after that. I experienced
>       the window error box 
randomly
> when calling another program (It was
>       omake).
>   
I was not able to produce any simple test program demonstrating the DLL
unloading problem (yet).

Do you think I should fill a bug report or am I wrong somewhere?

Salutations

Matt



      reply	other threads:[~2006-11-17  8:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-16 12:02 caml_startup/caml_cleanup Matthieu Dubuget
2006-11-17  8:20 ` Matthieu Dubuget [this message]

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=455D70C9.4070007@laposte.net \
    --to=matthieu.dubuget@laposte.net \
    --cc=caml-list@yquem.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