Home     |     .Net Programming    |     cSharp Home    |     Sql Server Home    |     Javascript / Client Side Development     |     Ajax Programming

Ruby on Rails Development     |     Perl Programming     |     C Programming Language     |     C++ Programming     |     IT Jobs

Python Programming Language     |     Laptop Suggestions?    |     TCL Scripting     |     Fortran Programming     |     Scheme Programming Language


 
 
Cervo Technologies
The Right Source to Outsource

MS Dynamics CRM 3.0

C# Programming

Load DLLs compiled using Mingw


Hello,

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
like so:

[DllImport("libtest.dll")]
         static extern void connections_init();

However when I call the function that wraps connections_init() I'm told
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?
  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. I also placed libtest.dll in c:\windows\system32
and it didn't help.  Any ideas?

thanks

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 (waw@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.

-----------------------------------------------Reply-----------------------------------------------

Walter Wang [MSFT] wrote:
> 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?

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 (waw@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.

-----------------------------------------------Reply-----------------------------------------------

Add to del.icio.us | Digg this | Stumble it | Powered by Megasolutions Inc