# Get rid of external library dependency

I am trying to generate C code for some functions, which I do not post in full because they are a few hundred lines long. The functions do nothing too fancy: a bunch of dot products, powers and roots.

Still, when compiling to C code Mathematica sticks in some unwanted dependency on its own libraries, which is not acceptable for the use case in question. The functions I am trying to compile have 5 arguments, 4 of which are 3-dimensional vectors.

The compile printout of one of them can be found here. As you can see, there are 3 Mathematica functions being pulled in: DotVV, Power and InternalReciprocalSqrt. Is there any way I can get rid of these without modifying the code manually?

Edit: here is the code I am using to compile the function

Compile[{{pos, _Real, 1} , {a, _Real, 1}, {v, _Real, 1}, {ba, _Real,
1} , {V, _Real}} ,
xSol, CompilationTarget -> "C"];

-
Can you whittle down your code and output to something that will fit in the Q? That would make it self-contained and easier to work with. –  Yves Klett Jul 4 '14 at 5:33
Thanks for your comment. Unfortunately how I get to xSol is quite complicated and requires some lengthy evaluations. As for the compiled code, I would not know how to shrink it. I have, however, included the call I am making to Compile, hoping that it helps. –  em70 Jul 4 '14 at 5:47
The outlook of reverse-engineering compiled code may not get you many takers. Providing code (e.g. in a linked notebook) would make the task easier, e.g. by identification of functions that do not compile, see. eg. List of compilable functions. –  Yves Klett Jul 4 '14 at 6:01
I do not expect anybody to reverse-engineer the code. That is just posted for reference. The point is that I have a huge expression which is, at its essence, just a large sum of the values of applications of the functions I listed in my question. Moreover, all of those are compilable, hence the question. I wonder if the fact that there is no size constraint on the vectors is the issue (how could Mathematica know that they are 3d otherwise?) –  em70 Jul 4 '14 at 6:10
@emaster70 I meant: this is an example that produces DotVV. As your question is posed, we'd need to come up with code that produces InternalReciprocalSqrt, DotVV and Power when compiled, solve the problem, then report to you. You could help by providing an example of problematic code. This is what I have been trying to hint at, but... –  acl Jul 4 '14 at 14:14