External calls returning byte arrays

While it is possible to essentially pass a byte array to an external call (say just as a char array) I believe the documentation states the only variable length data that can be returned from calls are strings .

While I am sure I could hex encode binary data send it to 010 then decode it and write it out to the existing file in memory? Not efficient but might work. The other option seems I could have the external lib write it to an external file, then open that file in 010 then run a partial template against it (as I don’t think I can access another file from a current template).

The use case I recently ran into was parsing onedrive log files. After a header they contain records of the activity the onedrive client has done. I figured write a template make life easier. The issue is sometimes the records are compressed in the file after the header as a big gzip/zlib stream of bytes. I can get these bytes easy enough, and heck I can include the 010 editor’s GZip template against them perfectly, but I can’t actually access that uncompressed data to make meaningful template output.

In the end I just wrote a full fledged program to do so based on the work of some others, but it seemed like a miss where the only real choice would be to implement gzip in 010 itself.

The other option would be if 010 had plugin/extension support but given the complexity of that I doubt it is coming any time soon.

Hi MitchC. You are right that currently only strings can be returned from DLL functions. However, if an array is passed to a DLL function and the types match, that array is passed by reference so the DLL function can write to that array and the values will be passed back. You just need to know the size of the array to allocate before passing it to the function and you may be able to determine that from the template or maybe have a function to call to figure out the size.

We are planning on adding gzip compressing/decompressing to templates along with some other compression algorithms. We’re not sure exactly how it is going to work yet but it is coming maybe in v16. Some sort of API/plugin support is also planned but that will probably be a little later.

Graeme
SweetScape Software