Using unmanaged dll in the personal environment not working

Using unmanaged dll in the personal environment not working

  
Hi there,

I am trying to import an unmanaged DLL using DLLimport.

        [DllImport("xxxxx.dll", SetLastError = true)]
        static extern UInt32 Test(UInt32 number);
 
I build the unmanaged DLL in Visual C++ 2010, and I build my extension in Visual C# 2010, both in Windows XP 32-bit.
The extension is set to Any CPU, and the dll is included in the project, with "copy to output directory: Copy Always". In Integration studio I set option Copy to Binaries folder.
If I build the unmanaged DLL as 32-bit, I get the error

"An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"

(looks like it finds the dll, but doesn't like it in 32-bit)

If I build the unmanaged DLL as 64-bit, I get the error

"Unable to load DLL 'xxxxx.dll': The specified module could not be found. (Exception from HRESULT: 0x8007007E)"

(looks like it does not find the dll)

Any hints? Should I build it for 32-bit or 64-bit, in the first place?

Thank you very much.
Best regards,
Pedro Vieira
Solved it!
First error I was right: I have to build the unmanaged DLL as 64-bit.
Second error is embarrassing ;-) I was compiling the DLL in Debug mode, which depends on debug system dll's which of course are not available on the server. Once I compiled it in Release mode, it worked.