@shiz Your solution looks correct. I didn't even get to the compiler warnings.
I did have to apply this patch to get the build working, due to me having set up Perl to default to Unicode mode:
https://e.pcloud.link/publink/show?code=XZFkMdZf77qLiQHiaQEU9Olf6ILmj1sxOqy