caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] ocaml_startup et Solaris/x86
@ 2003-11-03  7:56 Mathieu Avila
  2003-11-04  1:09 ` Jacques Garrigue
  0 siblings, 1 reply; 5+ messages in thread
From: Mathieu Avila @ 2003-11-03  7:56 UTC (permalink / raw)
  To: caml-list

Hello all,

I'd like to know whether there are known problems when mixing C and 
OCaml on the  Solaris/x86 platform.
The doc deals with particular flags to add for compiling on NT and 
Digital Unix on the Alpha, but there's nothing written for x86. I have a 
user of one of our tool written in Ocaml, who uses this platform and who 
informs us that the software crashes when it comes to call 
ocaml_startup, although everything goes right on solaris/sparc. Has this 
configuration been tested before ?
Thanks in advance !

-- 
Mathieu


-------------------
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


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

* Re: [Caml-list] ocaml_startup et Solaris/x86
  2003-11-03  7:56 [Caml-list] ocaml_startup et Solaris/x86 Mathieu Avila
@ 2003-11-04  1:09 ` Jacques Garrigue
  2003-11-04 13:52   ` Mathieu Avila
  0 siblings, 1 reply; 5+ messages in thread
From: Jacques Garrigue @ 2003-11-04  1:09 UTC (permalink / raw)
  To: mavila; +Cc: caml-list

From: Mathieu Avila <mavila@irisa.fr>

> I'd like to know whether there are known problems when mixing C and 
> OCaml on the  Solaris/x86 platform.
> The doc deals with particular flags to add for compiling on NT and 
> Digital Unix on the Alpha, but there's nothing written for x86. I have a 
> user of one of our tool written in Ocaml, who uses this platform and who 
> informs us that the software crashes when it comes to call 
> ocaml_startup, although everything goes right on solaris/sparc. Has this 
> configuration been tested before ?
> Thanks in advance !

I'm using ocaml on Solaris8/x86, and many C libraries, with no
problem.
However, one trouble with this platform is that there are many
possible combinations of C compiler/assembler/linker, depending of how
many GNU tools you are using.
There is also the problem of patches. There are numerous bugs in the
original release of Solaris8/x86, and some concern very essential
things like dynamic loading. Make sure all recommended patches from
Sun are installed.

If you happen to be using Solaris9/x86, I'm afraid it is not tested
yet.

Jacques Garrigue

-------------------
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


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

* Re: [Caml-list] ocaml_startup et Solaris/x86
  2003-11-04  1:09 ` Jacques Garrigue
@ 2003-11-04 13:52   ` Mathieu Avila
  2003-11-05  2:18     ` Jacques Garrigue
  0 siblings, 1 reply; 5+ messages in thread
From: Mathieu Avila @ 2003-11-04 13:52 UTC (permalink / raw)
  To: caml-list

Jacques Garrigue a écrit :

>From: Mathieu Avila <mavila@irisa.fr>
>
>  
>
>>I'd like to know whether there are known problems when mixing C and 
>>OCaml on the  Solaris/x86 platform.
>>The doc deals with particular flags to add for compiling on NT and 
>>Digital Unix on the Alpha, but there's nothing written for x86. I have a 
>>user of one of our tool written in Ocaml, who uses this platform and who 
>>informs us that the software crashes when it comes to call 
>>ocaml_startup, although everything goes right on solaris/sparc. Has this 
>>configuration been tested before ?
>>Thanks in advance !
>>    
>>
>
>I'm using ocaml on Solaris8/x86, and many C libraries, with no
>problem.
>
Are you able to call the ocaml code from the C ? I think this is rather 
different from calling C libs from a standalone OCaml code.
In my case, i mix the 2 langages in this way :

cmain.ml:
--------------------------------------------------------
let cmain_ocaml n = try
...
;;

let _ = Callback.register "cmain_ocaml" cmain_ocaml
--------------------------------------------------------

in a cmain_cpp.cpp , where there is the "real" main() function:
--------------------------------------------------------
 static value * cmain_closure = NULL;
 if (cmain_closure==NULL)
   cmain_closure = caml_named_value("cmain_ocaml");
 result = Int_val(callback(*cmain_closure,Val_int(n)));
--------------------------------------------------------

It crashses when calling :  callback(*cmain_closure...)

All is compiled into native solaris object code.
The same thing works perfectly on solaris/sparc.

--
Mathieu


-------------------
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


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

* Re: [Caml-list] ocaml_startup et Solaris/x86
  2003-11-04 13:52   ` Mathieu Avila
@ 2003-11-05  2:18     ` Jacques Garrigue
  2003-11-05  8:29       ` Mathieu Avila
  0 siblings, 1 reply; 5+ messages in thread
From: Jacques Garrigue @ 2003-11-05  2:18 UTC (permalink / raw)
  To: mavila; +Cc: caml-list

From: Mathieu Avila <mavila@irisa.fr>

> >I'm using ocaml on Solaris8/x86, and many C libraries, with no
> >problem.
> >
> Are you able to call the ocaml code from the C ? I think this is rather 
> different from calling C libs from a standalone OCaml code.

If you mean calling callback, I can. My libraries are full of
callbacks from C to caml.

> In my case, i mix the 2 langages in this way :
> 
> cmain.ml:
> --------------------------------------------------------
> let cmain_ocaml n = try
> ...
> ;;
> 
> let _ = Callback.register "cmain_ocaml" cmain_ocaml
> --------------------------------------------------------
> 
> in a cmain_cpp.cpp , where there is the "real" main() function:
> --------------------------------------------------------
>  static value * cmain_closure = NULL;
>  if (cmain_closure==NULL)
>    cmain_closure = caml_named_value("cmain_ocaml");
>  result = Int_val(callback(*cmain_closure,Val_int(n)));
> --------------------------------------------------------
> 
> It crashses when calling :  callback(*cmain_closure...)
> 
> All is compiled into native solaris object code.
> The same thing works perfectly on solaris/sparc.

Do I understand correctly than the C code above is inside the main
function?
Then I cannot see how it would work. Callback.register dynamically
adds "cmain_ocaml" to a table of known functions. If you don't call
ocaml's main function (i.e. the main() function of the ocaml C
runtime, or at least caml_main()), your caml function will not be
registered and this should not work.

Jacques Garrigue

-------------------
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


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

* Re: [Caml-list] ocaml_startup et Solaris/x86
  2003-11-05  2:18     ` Jacques Garrigue
@ 2003-11-05  8:29       ` Mathieu Avila
  0 siblings, 0 replies; 5+ messages in thread
From: Mathieu Avila @ 2003-11-05  8:29 UTC (permalink / raw)
  To: caml-list

Jacques Garrigue a écrit :

>From: Mathieu Avila <mavila@irisa.fr>
>
>  
>
>>>I'm using ocaml on Solaris8/x86, and many C libraries, with no
>>>problem.
>>>
>>>      
>>>
>>Are you able to call the ocaml code from the C ? I think this is rather 
>>different from calling C libs from a standalone OCaml code.
>>    
>>
>
>If you mean calling callback, I can. My libraries are full of
>callbacks from C to caml.
>
>  
>
>>In my case, i mix the 2 langages in this way :
>>
>>cmain.ml:
>>--------------------------------------------------------
>>let cmain_ocaml n = try
>>...
>>;;
>>
>>let _ = Callback.register "cmain_ocaml" cmain_ocaml
>>--------------------------------------------------------
>>
>>in a cmain_cpp.cpp , where there is the "real" main() function:
>>--------------------------------------------------------
>> static value * cmain_closure = NULL;
>> if (cmain_closure==NULL)
>>   cmain_closure = caml_named_value("cmain_ocaml");
>> result = Int_val(callback(*cmain_closure,Val_int(n)));
>>--------------------------------------------------------
>>
>>It crashses when calling :  callback(*cmain_closure...)
>>
>>All is compiled into native solaris object code.
>>The same thing works perfectly on solaris/sparc.
>>    
>>
>
>Do I understand correctly than the C code above is inside the main
>function?
>  
>
>Then I cannot see how it would work. Callback.register dynamically
>adds "cmain_ocaml" to a table of known functions. If you don't call
>ocaml's main function (i.e. the main() function of the ocaml C
>runtime, or at least caml_main()), your caml function will not be
>registered and this should not work.
>
>  
>
Sorry, i didn't show you all the useful code. There is a call to 
"ocaml_startup" with the appropriate
argv argument (i.e nothing). I believe this is where all initialisations 
are done. However, it works perfectly on Solaris/SPARC...

--
Mathieu



-------------------
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


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

end of thread, other threads:[~2003-11-05  8:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-03  7:56 [Caml-list] ocaml_startup et Solaris/x86 Mathieu Avila
2003-11-04  1:09 ` Jacques Garrigue
2003-11-04 13:52   ` Mathieu Avila
2003-11-05  2:18     ` Jacques Garrigue
2003-11-05  8:29       ` Mathieu Avila

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).