﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc
3733	C FMI export does not work with external functions	Rüdiger Franke	Adeel Asghar	"The new C FMI export uses a temporary build directory. This is why external includes are not found. Assume the following two files in your working directory:

ExternalFunction.mo:
{{{#!mo
package ExternalFunction
  function mySquare
    input Real x;
    output Real y;
    external ""C"" y = mysquare(x);
    annotation(Include=""#include \""mysquare.c\"""");  
  end mySquare;
  model Test
    input Real x = 0;
    output Real x2 = mySquare(5 + x);
  end Test;
end ExternalFunction;
}}}

mysquare.c:
{{{#!C
double mysquare(double x)
{
  return x*x;
}
}}}

The model ExternalFunction.Test simulates. C FMI export failes with the error:
{{{
ExternalFunction_Test_includes.h:4:22: fatal error: mysquare.c: No such file or directory
 #include ""mysquare.c""
}}}

This is because the subdirectory `ExternalFunction_Test.fmutmp/sources` was created for the compilation of the FMU. 

In the simplest case the FMU Makefile could be extended with a ""-I../.."" directive -- or not use a temporary build directory. A more advanced solution might copy all included files into the sources directory.

Anyhow, FMI export should work for a model that simulates. It was working before the introduction of source code FMUs."	defect	closed	blocker	1.9.4	FMI	v1.9.4-dev-nightly	fixed		Martin Sjölund
