Support user-provided DPI-C function declarations (#7626) (#7893)

Fixes #7626.
This commit is contained in:
Jakub Michalski
2026-07-08 05:22:24 -07:00
committed by GitHub
parent 93d0443998
commit 646dcd3838
14 changed files with 157 additions and 2 deletions
+6 -2
View File
@@ -1434,8 +1434,12 @@ void EmitCSyms::emitDpiHdr() {
if (!firstImp++) puts("\n// DPI IMPORTS\n");
putsDecoration(nodep, "// DPI import" + sourceLoc + "\n");
}
putns(nodep, "extern " + nodep->rtnTypeVoid() + " " + nodep->nameProtect() + "("
+ cFuncArgs(nodep) + ");\n");
if (nodep->dpiCDeclOverride()) {
putns(nodep, "extern " + nodep->dpiCDecl() + ";\n");
} else {
putns(nodep, "extern " + nodep->rtnTypeVoid() + " " + nodep->nameProtect() + "("
+ cFuncArgs(nodep) + ");\n");
}
}
puts("\n");