GenericValue of pointer becomes 0 when passed through RunFunction

I’m trying to pass a function pointer to the LLVM interpreter, but when I print it in the llvm function it is null. I’m using the C API.

Here’s the relevant code (It’s in D):

https://pastebin.com/hSbdDpfa

and here’s the output:

define void @fp_pass_test(void ()*) {

entry:

%1 = call i32 (i8*, …) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @0, i32 0, i32 0), void ()* %0)

call void %0()

ret void

}

passed ptr: 4142ddb0

unwrapped ptr: 4142ddb0

received ptr: 0

Program exited with code -11

Does anyone know why the pointer would become null after passing it through LLVMRunFunction?

Best Regards
Hakan