Look at dmlc/treelite, where you can do
import treelite
model = treelite.Model.load('my_model.model', model_format='xgboost')
model.compile(dirpath='./my_model_c99', verbose=True) # Generate C99 code
Treelite also provides for helper functions, such as prediction runtime in Python and Java.
As for variable (feature) name, I think XGBoost will check them, but if you are planning to implement your model in C++, you’ll have to check them manually. The idea is to maintain a mapping from feature name to integer index, e.g.
F0 -> 0
F1 -> 1
F2 -> 2
...
With this mapping, you can perform conversion from (feature name, feature value) pairs to a dense feature vector (with missing value as np.nan
(Python) or Float.NaN
(Java))