0

I developed MFC Regular DLL "Static Linked" using vs2005. when compiled it as 32-bit DLL

I can load it using "LoadLibrary" from my machine or from any other machine.

but when compile it as 64-bit DLL I can only load it from my machine.

I review my code and found global object declared.

MyClass myObj;

when I comment this object..I can load DLL and use it from diffrent machine.but when any

global object found...I can't load my DLL from diffrenet machine.

anyone can help me?

icecrime
  • 74,451
  • 13
  • 99
  • 111
NMM
  • 1
  • 1
  • 1

3 Answers3

2

when I try to use "GetLastError" it return number like "-529697949"

The error code is 0xe06d7363, the last 3 hex digits spell "MSC". That's the exception code for a C++ exception in Microsoft's compiler.

Your code is bombing on a uncaught C++ exception, probably thrown in DllMain(). You'll need a debugger if you can't reverse-engineer it from this hint.

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
  • can You explain how I can do that? – NMM Dec 13 '10 at 14:42
  • Well, I can only guess. Go by what the debugger tells you. – Hans Passant Dec 13 '10 at 15:06
  • Thanks for your reply..but at other machines I can't install VS2005 IDE to debug my DLL ... after I installed 64bit Visual C++ 2005 redistibutable my exe that load DLL produce exception says "Debug Error! This application has requested the Runtime to terminate it in a unusual way (Press Retry to debug the application) " – NMM Dec 14 '10 at 12:38
0

The uncaught C++ exception can also be thrown while the global/static objects of your dll are created/allocated/initialized (which is part of DllMain). So there is a good chance that somewhere in the code a valid throw statement is responsible for this behaviour (rather than some compiler/architecture/platform bug; maybe its just a define that is x64 specific?).

To find that nasty little *#!!:

  • Compile all your code with debug information (/DEBUG)
  • Turn on the Symbol Server (Debug/Options/Debugging/Symbols/Symbol file (.pdb) locations: [x] Microsoft Symbol Servers)
  • Turn on all Break on Exceptions (Debug/Exceptions.../ Tick all [] in the "Thrown" column)
  • Start Debugging and you will eventually find the correct place.

Due to the missing enforced "throws" statement like e.g. in Java (in c++ its optional and pretty useless; see Throw keyword in function's signature ), the try/catch/throw system is hardly usable to create robust and maintainable code; its almost like hiding random gotos everywhere.

Community
  • 1
  • 1
Oliver Zendel
  • 2,695
  • 34
  • 29
0

Does the target machine have the 64bit Visual C++ 2005 redistibutable installed? It's possible they have the 32 bit version installed from other application but that the 64 bit one has never been installed?

See http://www.microsoft.com/downloads/en/details.aspx?FamilyID=90548130-4468-4bbc-9673-d6acabd5d13b

jcoder
  • 29,554
  • 19
  • 87
  • 130