Hi Brandon,
Is it possible that this libtest.dll depends on other dlls that are not in
the same directory with it or in PATH environment? You can use Dependency
Walker (http://www.dependencywalker.com/) to view the dependent files.
Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Brandon McCombs - 31 May 2007 13:44 GMT
> Hi Brandon,
>
> Is it possible that this libtest.dll depends on other dlls that are not in
> the same directory with it or in PATH environment? You can use Dependency
> Walker (http://www.dependencywalker.com/) to view the dependent files.
Well I know it uses other DLLs but not sure if they are strictly
required. Do I need to specify a DllImport attribute for any DLLs
libtest.dll may depend on or will libtest.dll be able to access them
without importing them?
> Regards,
> Walter Wang (wawang@online.microsoft.com, remove 'online.')
[quoted text clipped - 6 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
Walter Wang [MSFT] - 01 Jun 2007 04:55 GMT
Hi Brandon,
You don't need to import every dependent dlls that libtest.dll uses.
However, if they're not in the same directory of libtest.dll, they need to
be put in a directory that in the PATH environment. Please note if one of
your dependent dll also depends on other files, this rule also applies.
That's why most of the shared dlls are put under %windir%\system32 because
normally this dll is always in the PATH environment.
Let me know if there's anything unclear. Thanks.
Regards,
Walter Wang (wawang@online.microsoft.com, remove 'online.')
Microsoft Online Community Support
==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
Brandon McCombs - 01 Jun 2007 23:43 GMT
> Hi Brandon,
>
[quoted text clipped - 17 lines]
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
> Yesterday I just started using Visual C# 2005 Express Edition and I'm
> trying to load external DLLs. I started out with trying to load just one
[quoted text clipped - 6 lines]
> it can't find the libtest.dll and therefore an exception is generated.
> This dll is compiled using the Mingw tools. Could that be the problem?
How do you link it ?
Have you tried specifying full path to the DLL in the DllImport ?
> I know that the library can be loaded if using VS6 or VS2003. Also, my
> syntax is correct since I can use user32.dll and pop up a message box
> with text. I also noticed that if I run regsvr32 on libtest.dll it says
> it can't find the library either and of course that is outside of the
> VC# 2005 environment.
regsvr32 are for COM DLL's not for Win32 DLL's.
Arne
Ben Voigt [C++ MVP] - 10 Jun 2007 01:38 GMT
>> Yesterday I just started using Visual C# 2005 Express Edition and I'm
>> trying to load external DLLs. I started out with trying to load just one
[quoted text clipped - 6 lines]
>> it can't find the libtest.dll and therefore an exception is generated.
>> This dll is compiled using the Mingw tools. Could that be the problem?
Is libtest.dll in the same directory as your .exe?
Did you open it with Dependency Walker (www.dependencywalker.com) and see if
"connections_init" function is exported?
If you know are using mingw tools, are you a C++ programmer? C++/CLI lets
code use both native and managed libraries seamlessly, and create a .NET
library that C# can use just like the built-in classes.
> How do you link it ?
>
[quoted text clipped - 9 lines]
>
> Arne