Snippet - RLPLite Function Generator

RLPLite Function Generator

I have been bitten a few times now that the address of one or more RLP functions change and I forget to update the addresses in the C# code.

So I threw together this quick and dirty utility that parses the GCC map file and generates the C# proxies. I include this in my build script so that after each compile of the native code the map file is parsed and the C# file is generated.

It is currently hard coded to look for functions in the map file that are prefixed with ‘RLP_’, you can tweak that matching of the functions by adjusting the regular expression used to match the function.

Usage:
RLPProxyGen
Where:
mapfile GCC map file to parse for RLP functions
outputfile Name of the C# file to create from the map
className Name of the C# class that will contain the functions

In my build script I have the following execute if the build GCC succeeded

RLPProxyGen Output\RLP1.map …\Managed\MyApp\RLPMethods.cs RLPMethods

This will scan the RLP1.map file and generate the RLPMethods file with a static class called RLPMethods which contains the RLP entry points. Please see the usage example for an example of the generated class.

This is by no means a robust tool, but it does the job for what I am currently doing ie. RLPLite on the Hydra. As I find things that are useful in my build workflow I will update this if required.

1 Like

Thanks.
"Any thing worth doing, is worth writing a tool"
I just love tools.

Brilliant for sure

Haha, I have the same tool in the repository of the 3D engine. But mine also takes the .c(pp) file that contains the functions to export so you’re not limited to using a prefix.

@ WouterH - How do we get access to the repository of the 3D engine?

If you have a bitbucket account, share me your email address and I’ll invite you. It’s a git repository.

@ WouterH - I just created an account, my email is chris_taylor_za at yahoo dot com.