i have used it for the lite-c filepacker. maybe you can learn something from the source.