Skip to content

Commit

Permalink
C++ co-simulation linking fix
Browse files Browse the repository at this point in the history
C++ top-function wrapper is generated using C linkage to avoid type
mangling issues caused by missing qualifiers and/or array types
  • Loading branch information
Ansaya committed Nov 7, 2023
1 parent 1cdac72 commit cfa840d
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ void HLSCWriter::WriteMainTestbench()
}
return idx_size;
}();
const auto extern_decl = top_fname == top_fname_mngl ? "EXTERN_C " : "";
const auto extern_decl = top_fname != top_fname_mngl ? "EXTERN_C " : "";

std::string top_decl = extern_decl;
std::string gold_decl = extern_decl;
Expand Down Expand Up @@ -687,9 +687,9 @@ void HLSCWriter::WriteMainTestbench()
top_decl += "void";
gold_decl += "void";
}
top_decl += " " + top_fname + "(";
gold_decl += " __m_" + top_fname + "(";
gold_call += "__m_" + top_fname + "(";
top_decl += " " + top_fname_mngl + "(";
gold_decl += " " + cxa_prefix_mangled(top_fname_mngl, "__m_") + "(";
gold_call += cxa_prefix_mangled(top_fname_mngl, "__m_") + "(";
pp_call += "__m_pp_" + top_fname + "(";
if(top_params.size())
{
Expand Down

0 comments on commit cfa840d

Please sign in to comment.