Reputation: 943
I know I can’t compile my C# code using the default ”Platform Target : Any CPU” build setting and call a 32 bit C DLL. But if I change this setting to ”Platform Target : x86” the C# code should run under a 32-bit context and call the C DLL under that 32 bit context right? Although it doesn’t seem to work.
Do I have to register the 32-bit C DLL with some special registry or something?
I am using Windows Server 2003 64 bit.
The error is:
Runtime Error!
[Path to dll]
R6034
An application has made an attempt to load the C runtime library incorrectly.
Upvotes: 1
Views: 581
Reputation: 564891
You are correct. If you're building with the platform set to x86, your 32bit DLL should work fine.
If it's not, here are some things to check:
Edit: After seeing your comment, your issue is due to the DLL not having a proper manifest. If you embed a manifest in the DLL, it should be able to properly resolve the correct C runtime, and load it (provided the correct runtime is installed on the deployment machine.)
Upvotes: 2