[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.interop

Loading 32-bit unmanaged DLL on Windows XP 64-bit with x86 .NET 2.0 Framework

Emmanuel Stapf [ES]

2/2/2007 2:14:00 AM

Hi,

I have two machines running Windows XP 64-bit. On one machine it works, and on
the other it does not. All my assemblies have been compiled on a Windows 32-bit
platform and I'm trying to execute them on the 64-bit machine. The .exe assembly
has the 32bit flag set (verified through corflags).

When this assembly tries to do a PInvoke call it fails to load our unmanaged DLL
with the DllNotFoundException. Although this is not correct since our DLL is
next to the .exe assembly, and that it works on the other 64-bit machine.

Debugging with WinDbg, I found there was a C++ exception being raised in the
unmanaged code of the .NET runtime and the callstacks had calls to
CorLaunchApplication and GetAddrOfContractShutoffFlag. Looking around it seems
the second call is related to some security settings, but I'm not sure. I've
tried `caspol -s off' and it did not have an effect.

Can you help me figure out what could be wrong with this loading?

Thanks,
Manu
3 Answers

Christian Fröschlin

2/2/2007 9:07:00 AM

0

Emmanuel Stapf [ES] wrote:

> When this assembly tries to do a PInvoke call it fails to load our
> unmanaged DLL with the DllNotFoundException. Although this is not
> correct since our DLL is next to the .exe assembly, and that it works on
> the other 64-bit machine.

Possibly your native DLL depends on yet another DLL which is not
available on the machine exhibiting the problem. Try checking it
using Dependency Walker.

Emmanuel Stapf [ES]

2/2/2007 6:57:00 PM

0

Christian Fröschlin wrote:
> Emmanuel Stapf [ES] wrote:
>
>> When this assembly tries to do a PInvoke call it fails to load our
>> unmanaged DLL with the DllNotFoundException. Although this is not
>> correct since our DLL is next to the .exe assembly, and that it works
>> on the other 64-bit machine.
>
> Possibly your native DLL depends on yet another DLL which is not
> available on the machine exhibiting the problem. Try checking it
> using Dependency Walker.

I've check this and this does not seem to be the case. Should I try to do a C
program using `LoadLibrary' just to see if I get a meaningful error?

Regards,
Manu

Emmanuel Stapf [ES]

2/3/2007 12:06:00 AM

0

Emmanuel Stapf [ES] wrote:
> Christian Fröschlin wrote:
>> Emmanuel Stapf [ES] wrote:
>>
>>> When this assembly tries to do a PInvoke call it fails to load our
>>> unmanaged DLL with the DllNotFoundException. Although this is not
>>> correct since our DLL is next to the .exe assembly, and that it works
>>> on the other 64-bit machine.
>>
>> Possibly your native DLL depends on yet another DLL which is not
>> available on the machine exhibiting the problem. Try checking it
>> using Dependency Walker.
>
> I've check this and this does not seem to be the case. Should I try to
> do a C program using `LoadLibrary' just to see if I get a meaningful error?

After all this was a missing dependency. Would be nice if the exception message
was clearer.

Thanks for the help.
Manu