diff --git a/src/evaluate.rs b/src/evaluate.rs index 78ebe19..947db48 100644 --- a/src/evaluate.rs +++ b/src/evaluate.rs @@ -1179,10 +1179,11 @@ impl ExpressionEvaluator { } pub fn export_asm_str(&self, function_name: &str, include_header: bool) -> String { - let mut res = if include_header { - "#include \n#include \n#include \n\n".to_string() - } else { - String::new() + let mut res = String::new(); + if include_header { + res += &"#include \n#include \n#include \n\n"; + res += &"extern \"C\" void drop_buffer_complex(std::complex *buffer)\n{\n\tdelete[] buffer;\n}\n\n"; + res += &"extern \"C\" void drop_buffer_double(double *buffer)\n{\n\tdelete[] buffer;\n}\n\n"; }; res += &format!( @@ -1190,7 +1191,6 @@ impl ExpressionEvaluator { function_name, self.stack.len() ); - res += &"extern \"C\" void drop_buffer_complex(std::complex *buffer)\n{\n\tdelete[] buffer;\n}\n\n"; res += &format!( "static const std::complex CONSTANTS_complex[{}] = {{{}}};\n\n", @@ -1215,8 +1215,6 @@ impl ExpressionEvaluator { function_name, self.stack.len() ); - res += - &"extern \"C\" void drop_buffer_double(double *buffer)\n{\n\tdelete[] buffer;\n}\n\n"; res += &format!( "static const double CONSTANTS_double[{}] = {{{}}};\n\n",