Amirouche Boubekki <amirou...@hypermove.net> writes: > I triple checked the %fs-progress-info definition, it's correct, > but I still get incorrect value for status field, see download.scm > line 13.
Wow, GNUNET_FS_ProgressInfo is hell of a struct. :-) I also checked the bytestructure definition just in case but yes it seems correct. Here are some possibilities I can think of, wildly speculatively. - %time-relative is defined wrong (I couldn't find the corresponding GNUNET_TIME_Relative definition to compare) - %crypto-ecdsa-public-key is defined wrong (I couldn't find the corresponding GNUNET_CRYPTO_EcdsaPublicKey definition to compare) If both of those are correct, further possibilities would be: - Some or all of the structs in the C code are "packed". - There's a bug in bytestructures. To rule out these two, you can use a simple test case: write a tiny C lib with a function that allocates a GNUNET_FS_ProgressInfo struct, writes to its status field, and returns a pointer to it. Load the lib from Scheme, call the function through FFI... you know the rest; see if you get the correct value when you read the status field from Scheme. If you get the correct result, further possibilities: - The wrong pointer is being passed to pointer->bytestructure for whatever reason. - The status field is being read at the wrong time for whatever reason. (Be extra careful if the code is multi-threaded.) - The struct is being deallocated before Scheme code is done with it. Hope that helps, Taylan