caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Error whith DynLink module
@ 1999-03-04 10:02 Hugues CASSE
  1999-03-09 14:42 ` Xavier Leroy
  0 siblings, 1 reply; 2+ messages in thread
From: Hugues CASSE @ 1999-03-04 10:02 UTC (permalink / raw)
  To: CAML

I use the follozing function to load a declaration using only
definition from Syntax module defined into /home/casse/absint/intptr/
directory. This piece of code is contained in file loadprog.ml, module
Loadprog, and all is successfully compiled by the line :

	ocamlc dynlink.cma syntax.ml loadprog.ml -o loadprog

  
let load_prog name =
	Dynlink.init ();
	print_endline "OK !"; flush stdout;
	Dynlink.add_interfaces
		["Syntax"]
		["/home/casse/absint/intptr/"; "/usr/local/caml/ocaml-2.00/lib/"];
	print_endline "KO !"; flush stdout;
	try
		begin
			Dynlink.loadfile name;
			true
		end
	with Dynlink.Error err ->
		print_endline (Dynlink.error_message err); false

  Zhen I execute the program, I get the following output...

OK !
KO !
no implementation available for Digest

  Can somenody help me ?

-- 
------------------------------------------------------------------------
CASSE Hugues             |Heureux qui,comme Ulysse,a fait un beau voyage
IRIT, 1R1, p14	         |Ou comme celui-la qui conquit la Toison,
                         |Et puis est retourne plein d'usage et raison,
PHONE: (+33)5-61-556-611 |Vivre entre ses parents le reste de son age !
       (poste 73-20)     |                        Les Regrets, Du Bellay
------------------------------------------------------------------------
mailto:casse@irit.fr                    http://www.irit.fr/~Hugues.Casse




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

* Re: Error whith DynLink module
  1999-03-04 10:02 Error whith DynLink module Hugues CASSE
@ 1999-03-09 14:42 ` Xavier Leroy
  0 siblings, 0 replies; 2+ messages in thread
From: Xavier Leroy @ 1999-03-09 14:42 UTC (permalink / raw)
  To: Hugues CASSE, CAML

> let load_prog name =
> 	Dynlink.init ();
> 	print_endline "OK !"; flush stdout;
> 	Dynlink.add_interfaces
> 		["Syntax"]
>       [...]
> 	with Dynlink.Error err ->
> 		print_endline (Dynlink.error_message err); false
> 
>   Zhen I execute the program, I get the following output...
> 
> OK !
> KO !
> no implementation available for Digest
> 
>   Can somenody help me ?

What about adding "Digest" to your call to Dynlink.add_interfaces?

 	Dynlink.add_interfaces ["Syntax"; "Digest"; ...] ...

Actually, you should add all standard library modules that the
dynamically-linked module might need, e.g. Pervasives, String, Char,
List, etc.

Yes, it is a pain to list them all, but for dynamic linking of
untrusted code in a secure environment (the initial application of
Dynlink), it must be done this way.

Hope this helps,

- Xavier Leroy




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

end of thread, other threads:[~1999-03-10  9:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-03-04 10:02 Error whith DynLink module Hugues CASSE
1999-03-09 14:42 ` 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).