c++ - Weird compiling problem - DLL not compiled the same on some machines -


i'm not asking tell me problem is, i'm asking sanity checks should run in case this.

using visual studio 2005, plain c++ project. actual code is:

int sum(int a, int b) {     return a+b; } 

no pre-compiled headers. exported def file:

library testdll exports     sum 

compiled on test machine (vs2005 again), dll works on other machines (64 bit , 32 bit tested, compiled win32 target platform). compiled on machine (64 bit, same project, same properties), dll works only on machine, on others starts just-in-time debugger (or crashes horribly if jit isn't installed):

unhandled exception @ 0x00000000 in caller.exe: 0xc0000005: access violation reading location 0x00000000.

at first calling on test machines, , fail too, giving me (with cder) "file not found" error.

other symptom: file size different, machine gives dll 512 bytes.

my system configuration:

  • windows vista - 64 bit
  • vs2005 version 8.050727.867 (vsvista.050727-8600)
  • .net framework version 2.0.50727 sp2

tested environments:

  • windows xp - 32 bit (virtual machine)
  • vs2005 version 8.0.50727.42 (rtm.050727-4200)
  • .net framework version 2.0.50727 sp2

  • windows xp - 64 bit

  • vs2005 version 8.0.50727.42 (rtm.050727-4200)
  • .net framework version 2.0.50727 sp2

i suppose "win32 target platform" wrong configured on 64-bit machine. recommend start "visual studio 2005 command prompt" , use

dumpbin.exe /headers youdll.dll

to examine "wrong" dll produced on 64-bit machine. can compare "good" dll. suppose see differences. windiff.exe can additionally.

one small general advice: consider use extern_c , winapi (or __stdcall) functions export dll.


Comments