Using a 32bit or 64bit dll in C# DllImport

I’ve found the simplest way to do this is to import the two methods with different names, and calling the right one. The DLL won’t be loaded until the call is made so it’s fine: [DllImport(“MyDll32.dll”, EntryPoint = “Func1”, CallingConvention = CallingConvention.Cdecl)] private static extern int Func1_32(int var1, int var2); [DllImport(“MyDll64.dll”, EntryPoint = “Func1”, CallingConvention … Read more

C# compiling for 32/64 bit, or for ‘Any CPU’? [duplicate]

On a 32-bit machine: Any CPU: runs as a 32-bit process, can load Any CPU and x86 assemblies, will get BadImageFormatException if it tries to load an x64 assembly. x86: same as Any CPU. x64: BadImageFormatException always. On a 64-bit machine: Any CPU: runs as a 64-bit process, can load Any CPU and x64 assemblies, … Read more

Huge performance difference (26x faster) when compiling for 32 and 64 bits

I can reproduce this on 4.5.2. No RyuJIT here. Both x86 and x64 disassemblies look reasonable. Range checks and so on are the same. The same basic structure. No loop unrolling. x86 uses a different set of float instructions. The performance of these instructions seems to be comparable with the x64 instructions except for the … Read more

Why is long slower than int in x64 Java?

My JVM does this pretty straightforward thing to the inner loop when you use longs: 0x00007fdd859dbb80: test %eax,0x5f7847a(%rip) /* fun JVM hack */ 0x00007fdd859dbb86: dec %r11 /* i– */ 0x00007fdd859dbb89: mov %r11,0x258(%r10) /* store i to memory */ 0x00007fdd859dbb90: test %r11,%r11 /* unnecessary test */ 0x00007fdd859dbb93: jge 0x00007fdd859dbb80 /* go back to the loop top … Read more

Conditionally use 32/64 bit reference when building in Visual Studio

Here is what I’ve done in a previous project, which will require the manual edition of the .csproj file(s). You also need separate directories for the different binaries, ideally siblings of each other, and with the same name as the platform you are targeting. After adding a single platform’s references to the project, open the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)