Using stan with external computer code

Start with a short summary of your inquiry.
I have a type of (temporal) regression problem where the regression function is a complex function only available as computer code (given input parameters with some priors. Is it possible to use Stan in such cases?

The only external code supported by Stan is c++, with additional restriction that Stan must be able to auto-differentiate it - whether this is by only using basic functions for which gradients are already available, or by also calculating the gradients as part of your code.