When you compile a .pas
file in a C++Builder project, an .hpp
header file is automatically created that you can then #include
in your C++ code where needed. There is no need to declare the function manually.
The linker error is due to your use of extern "C"
on the C++ side. That is affecting how the C++ compiler emits name mangling/decoratation for that function, so it does not match the name mangling/decoration that the Delphi compiler emits. That is why the linker cannot find the function implementation. Remove the extern "C"
and then both compilers should emit the same name mangling/decoration to allow the linker to match them up.