0

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.

1
  • #1 is an option though. You can build .sln/.proj project from command line, you can build it from CI; it has been done for years. #2 option as described in that article looks like a huge hack. Commented Dec 12 at 15:12

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.