Sorry for not being very clear. You're correct, pst_file is a struct with d_head being a pointer to another struct. Within libpst (the C library I'm working with), when you call pst_open() you pass pst_file by reference which opens the PST file (MS outlook file) and populates the pst_file struct. d_head is a pointer to another struct that holds individual records pulled out of the PST file. When the pst_open() call returns I need to take the d_head pointer, assign it to another pointer variable of type pst_desc_tree and use that to pass into another function.
pst_item *item = NULL;
pst_desc_tree *d_ptr;
pst_open(&pstfile, file_name, NULL);
d_ptr = pstfile.d_head; // first record is main record
item = pst_parse_item(&pstfile, d_ptr, NULL);
The way I did it which seems to work is:
var f = new pst_file(); //the main pst_file struct
var pstdesctree_Ptr = ref.refType(pst_desc_tree);
var d_ptr = ref.alloc(pstdesctree_Ptr);
ref.writePointer(d_ptr, 0, f.d_head);
This seems to copy the correct pointer, however when I do:
ref.deref(d_ptr)
I get a segmentation fault.
How would I get access to the variables stored in that struct inside node?
I didn't finish converting all the structs yet but give you an idea of what the code looks like. In the SRC directory I included the .c and .h files so you can see the structures.
Thanks,
Roy