Version française
Home     About     Download     Resources     Contact us    
Browse thread
marshalling objects
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Pietro Abate <Pietro.Abate@a...>
Subject: marshalling objects
Hi all,

It's not clear to me if it is possible or not to marshall objects ? From
my tests it is not the case (output_value: abstract value (outside
heap).). Am I missing something ? What is common practice to send
objects across the wire ?

thanks,
p

--------- ex.ml

class node = object val d = 1 end ;;

let l =
    try
        let a = (new node) in
        let s = (Marshal.to_string a [])
        in print_endline "Success"; (Marshal.from_string s 0 : node)
    with Invalid_argument s -> print_endline ("Failed "^s) ; (new node)
;;

let l =
    try
        let a = (new node) in
        let s = (Marshal.to_string a [Marshal.Closures])
        in print_endline "Success"; (Marshal.from_string s 0 : node)
    with Invalid_argument s -> print_endline ("Failed "^s) ; (new node)
;;

let l =
    try
        let a = (new node) in
        let s = (Marshal.to_string a [Marshal.No_sharing])
        in print_endline "Success"; (Marshal.from_string s 0 : node)
    with Invalid_argument s -> print_endline ("Failed "^s) ; (new node)
;;

let l =
    try
        let a = (new node) in
        let s = (Marshal.to_string a [Marshal.No_sharing;Marshal.Closures])
        in print_endline "Success"; (Marshal.from_string s 0 : node)
    with Invalid_argument s -> print_endline ("Failed "^s) ; (new node)
;;


-- 
++ Blog: http://blog.rsise.anu.edu.au/?q=pietro
++ 
++ "All great truths begin as blasphemies." -George Bernard Shaw
++ Please avoid sending me Word or PowerPoint attachments.
   See http://www.fsf.org/philosophy/no-word-attachments.html