What is the target (e.g. x86 or x64) of the:
1) main application
2) dll you are trying to load

Are they both being compiled to the same target?