Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
x/sys/windows: call 32bit dll in 64bit windows panic when pass float64(double) parameter #29092
What version of Go are you using (
When you call any function, your arguments must match function parameters. I think, some of yours do not match.
and Go passes
First C f32 parameter looks OK, because (according to https://docs.microsoft.com/en-us/previous-versions/cc953fe1(v=vs.140) ) C float expects 4 bytes, and you pass uintptr (4 bytes). So match here.
But C f64 takes 8 bytes, while Go parameter is uintptr (4 bytes). This is not allowed. I think you want to split Go f64 into 2 uintptr values (upper and lower 4 bytes), and pass them to dllFunc.Call as separate parameters.
I did not look passed C f64, but similar logic would apply.
I do not have Visual C to build your DLL, and you did not provide the DLL source, so I cannot verify my theory. But I don't think there is anything to fix here - this is all working as expected. Let me know, if I am wrong.