Converting Fuse headers
jessekphillips+D at gmail.com
Sat Nov 6 22:42:04 PDT 2010
I'm trying to make fuse work in D. I had some help from htod, but not everything was successful. And I'm not exactly sure how to properly convert strings and such.
What I currently have allows me to compile some fuse programs (hello for example). But the result is a dead link (only seem to be able to fix it by rebooting). Anyway the specific questions I want to get out of the way are as follows.
hello_str = cast(char*) toStringz("Hello World!\n");
I stopped doing this, but I'm just wondering how you could get a modifiable C string if I needed one?
fuse.d:669 auto user_data = new ubyte;
fuse.d:670 return fuse_main_real(cast(int) argc, argv, op, (*(op)).sizeof, user_data.ptr);
This is likely a big part of the problem, but I just didn't understand the C. It is a defined as:
#define fuse_main(argc, argv, op, user_data) \
fuse_main_real(argc, argv, op, sizeof(*(op)), user_data)
But is called:
return fuse_main(argc, argv, &hello_oper);
And I can't find a three argument fuse_main. So I made one and just passed a block of storage (converting to a pointer so the compiler wouldn't complain of conversions and I didn't cast)
Then there is a structure which had some padding, and htod didn't fully convert it, leaving off two fields at the end. Maybe I should move them to just after the bit field? I think it would be fine...
The last one is the node structure. Which I found in fuse.c but seems to be used a lot so I don't no why it isn't in a header. This used the is_hidden : 1 notation so I created some bit fields, but it didn't have padding like the others, so I don't know if I did this correctly.
This is probably trivial bindings for those who know C better, but it has been fun. The links are below, and I was using the 2.8.4 header files.
More information about the Digitalmars-d-learn