I have a simple file with plain C code with just one function:
int Foo()
{
return 123;
}
I'm on Windows x64 and want to build a DLL from this file for arm64. I found the article - Build Arm64X binaries, but the options there are 1) build from VS 2) build with CMake 3) pure forwarder dll.
I want to build DLL within CI process, and this DLL will contain real functions, so #1 and #3 are not the options. Regarding CMake: what I need to perform the task? Or maybe there is a way to do this with other tools?
What I've tried:
clang-cl --target=aarch64-windows-msvc -D_USRDLL -DEXPORTS_API -O3 code.c -c -o code.obj
lld-link /DLL code.obj /OUT:code.dll /IMPLIB:code.lib
DLL file is produced, but when I try to call the function from it from C#:
[DllImport("code", EntryPoint = "Foo", CallingConvention = CallingConvention.Cdecl)]
static extern int Foo();
I'm getting the exception EntryPointNotFoundException on arm64 VM. So obviously something is wrong with the DLL.