You declare:
declare dllimport x86_stdcallcc void @GetLocalTime(%SYSTEMTIME*)
Which is absolutely correct; but when you call it:
call void @GetLocalTime(%SYSTEMTIME* %now)
You forgot the x86_stdcallcc
calling convention. From the documentation of call
:
The calling convention of the call must match the calling convention of the target function, or else the behavior is undefined.
So perhaps adding the cc would fix this issue.