I understand that if I compile it and export to file I can use it outside, am I wrong?
It's not as simple as that. It is possible to convert a Compile
d function into C code, which can then be used as a component in your C project. You would need to link against the WolframRTL shared library, which comes with desktop Mathematica (I have no idea about the license terms of distributing WolframRTL).
The set of functions that can be used in such a compiled function is limited, and making everything work would take some effort.
Anything symbolic, such as Integrate
, will absolutely not work. Many otherwise numerical functions, such as ChebyshevT
, also won't work. Check here for a method to rule out most such functions: https://mathematica.stackexchange.com/a/1105/12
Here's the relevant documentation for generating stand-alone code: