To avoid this issue you can call the two functions in a separate function. This will lead to the code to be generated in a way that there are no name conflicts.
To illustrate this, attached you find a small test project consisting of the following folders:
In myfun and myfun2 we call max() with different arguments, which leads to different implentations of max() in the generated C code (as described earlier).
Now examine the parent function. Here we again call myfun and myfun2 with different arguments:
>> emlc parent.m -eg {rand(10,1),rand(5,1), rand(7,1), rand(7,1)} -O disable:inline
With this the compiler sees that max() is used with different arguments and return values, and it generates two different implementations which are used:
* myfun.c: m_max(eml_a, eml_y, eml_x);
* myfun2.c: m_b_max(eml_a, eml_b, eml_my2);
This prevents a function name conflict from occurring.
Best Answer