473,382 Members | 1,710 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

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
May 31 '07 #1
6 2930
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 (wa****@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.

May 31 '07 #2
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?

>
Regards,
Walter Wang (wa****@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.
May 31 '07 #3
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 (wa****@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.
Jun 1 '07 #4
Walter Wang [MSFT] wrote:
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 (wa****@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.

Jun 1 '07 #5
Brandon McCombs wrote:
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?
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
Jun 9 '07 #6

"Arne Vajhøj" <ar**@vajhoej.dkwrote in message
news:46***********************@news.sunsite.dk...
Brandon McCombs wrote:
>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?
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 ?

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
Jun 10 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Ernesto | last post by:
Hi everybody: I do not know if this is the right newsgroup for my issue, but I think that someone here knows about this issue: I am developing a set of libraries in C++ and I want to export my...
0
by: Eric Twietmeyer | last post by:
Hello, Am I mistaken in thinking that if I have a mc++ dll that I should be able to link against it (so long as it has exported symbols via declspec(dllexport)) in an unmanaged application? I...
3
by: nfedin | last post by:
I have a web app that I have written on a test server. I have written my own classes and compiled them in several DLL files, which are located in the /bin directory. I am now trying to move the...
1
by: z. f. | last post by:
Hi, i have a dot-net app. the first load is really slow, about 4 seconds at least. next requests are very fast. is there a way to analyze the buttleneck in the load process of a asp-net...
2
by: John Bailey | last post by:
I have checked around and could not find anything here that exactly matches my issue, which is odd since I have found numerous posts on this in other news groups. I have a ASP .Net 2.0 site that...
3
by: =?Utf-8?B?WmlhbmdpIEpvbmVz?= | last post by:
Hi, I m using VS .NET 2003 to create a website. Using the setup package I create a setup as well. But this setup has files with actual code in it & not pre-compiled DLLs. Please let me know...
10
by: =?Utf-8?B?UmljaGFyZA==?= | last post by:
Hi, I usually deploy my ASP .NET application to the server by publishing, using Visual Studio 2005 publish feature. This creates the Bin folder on the server, with the compiled DLLs. I've...
1
by: my cats, Gag and yak | last post by:
I am trying to decrease the time a asp 3.5 website loads. Does changing the business layer to separate DLLs ( so they are only in memory when needed ) improve load time, or, . . . any help is...
5
by: Med | last post by:
Hi, Initial load of my pre-compiled ASP.NET app takes more than 50 seconds to load after site has been idle for a while. Then it become fairly fast. Followings are my app/hardware configs: ...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.