PInvoke/Interop to access unmanaged code

Hi.

I have a c# program which is using an unmanaged 3rd party dll to control a device. I am using the following code to access the dll:

[DllImport("3rdPartyInf.dll")]
public static extern uint Init([In]int par1, [Out] char[] param2, [Out] uint param3);
Now, the problem is that while this is fine for our desktop machines, it throws a DllNotFoundException - Unable to load DLL ("3rdPartyInf.dll") if I try to use a laptop (Dell Latitude D800). It makes no difference whether I try to access the dll from vc++ or from c# - even from vb!

All the machines are running XP SP2, .Net Framework 1.1, VS 2003 etc. I have checked the paths, .config files, hotfixes etc.

I can't debug into the error and am starting to run short of ideas, anyone else got any?!

Thanks.

[781 byte] By [Paul_G] at [2007-12-16]
# 1
Is the 3rd part DLL "3rdPartyInf.dll" registered on the laptop? You might want to unregister and register the DLL.

Ayyappan Nair

A.G.Nair at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 2
Keep in mind that the DllNotFoundException may also refer to a .dll that your 3rdPartyInf.dll depends on. Make sure all dependencies are present on the machine as well.

ChrisDunaway at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...
# 3
Hi.

Yes, I have copied all the dependancies to the same location as the referenced dll. I have also tried registering it - but I get the following error from regsvr32:

_

LoadLibrary("[location]\3rdPartyInf.dll") failed - Attempt to access invalid address.
_
What is really confusing me is that this error only happens on my Dell Latitude D800 (Laptop). It appears to be fine on all of the desktops I have access to. Is there a hardware issue, which might be preventing access to something?

Thanks for your help thus far.

Paul_G at 2007-9-9 > top of Msdn Tech,.NET Development,.NET Base Class Library...

.NET Development

Site Classified