A little history - skip to the TL;DR if you so wish to.
So I have an UWP application written in C++ that utilizes V8 and have synthetic module which allows calling native methods from the embedded JS code.
Now until recently I was writing Node.JS tool that parses C header files and creates JS modules which can be used by my production JS code to ease calling COM methods (i.e. instead of raw_call(object, 5, ...)
you can do something like raw_call(object, Interface.Method_Name, ...)
or even in the future just object.Method_Name(...)
. Anyway that is not important. The important part is that for creating this modules I use regular expressions - it turned out that however JS Regular Expressions doesn't support recursion - so I sneaked some php
executer solely for the purpose of executing PHP regular expressions inside my tool (so I can utilize recursion). Then later on I realized that PHP regex doesn't support capturing groups inside recursion and that is a feature only present in pcre2.
Pcre2 is C only which is fine for my production code - I can just use my already created infrastructure to invoke those directly from JS - problem is that this is a feature for my tool not production code.
I'm using MSVC 2019 Preview and I can probably do some shenanigans with multiple projects but like I would have to support two identical code bases - one for production and one for a tool. Hmm maybe I can include the same source files?
TL;DR - How to most efficiently reuse production code in writing supporting tools for your application?