473,385 Members | 1,912 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,385 software developers and data experts.

DllImport

Hi,

Imagine the following situation : a.dll depends on b.dll and a.dll is
imported in C# with DllImport["a.dll"].
Is it correct that if b.dll cannot be found, you get an error about a.dll
and *not* about b.dll ?

Thanks,
Bart

--
www.xenopz.com
Mar 19 '06 #1
6 2817
Bart,

If you import a dll that has one or more dependancies missing, you should
get an error message about the DLL you are importing, not being able to
load.

Regards
Scott Blood
C# Developer
"Bart" <Ba**@discussions.microsoft.com> wrote in message
news:A1**********************************@microsof t.com...
Hi,

Imagine the following situation : a.dll depends on b.dll and a.dll is
imported in C# with DllImport["a.dll"].
Is it correct that if b.dll cannot be found, you get an error about a.dll
and *not* about b.dll ?

Thanks,
Bart

--
www.xenopz.com

Mar 20 '06 #2
Bart,

The easiest way to find out is to test the case. Did you test it? What was
the result?

I can see both possible. I'd peffer to get an arror anout a.dll, but never
tried.
--

Stoitcho Goutsev (100)

"Bart" <Ba**@discussions.microsoft.com> wrote in message
news:A1**********************************@microsof t.com...
Hi,

Imagine the following situation : a.dll depends on b.dll and a.dll is
imported in C# with DllImport["a.dll"].
Is it correct that if b.dll cannot be found, you get an error about a.dll
and *not* about b.dll ?

Thanks,
Bart

--
www.xenopz.com

Mar 20 '06 #3
Hi Scott,

Thanks for the reply. That's indeed the behaviour I've seen, is there any
way to get error message which indicate which dll is missing ?

Thanks,
Bart
--
www.xenopz.com
"scott blood" wrote:
Bart,

If you import a dll that has one or more dependancies missing, you should
get an error message about the DLL you are importing, not being able to
load.

Regards
Scott Blood
C# Developer
"Bart" <Ba**@discussions.microsoft.com> wrote in message
news:A1**********************************@microsof t.com...
Hi,

Imagine the following situation : a.dll depends on b.dll and a.dll is
imported in C# with DllImport["a.dll"].
Is it correct that if b.dll cannot be found, you get an error about a.dll
and *not* about b.dll ?

Thanks,
Bart

--
www.xenopz.com


Mar 20 '06 #4
Hi Stoitcho,

I did test the a.dll - b.dll case. Personally, I think that the (default)
behaviour is a bit confusing. The run time complains about not finding a call
in a.dll, while the actual problem is the absence of b.dll.
This is particulary annoying while interfacing with matlab : matlab
instructs to use "dependency walker" to find all dependent dlls. In such a
case, it would be nice if the run time informs you about missing dlls.

Regards,
Bart
--
www.xenopz.com
"Stoitcho Goutsev (100)" wrote:
Bart,

The easiest way to find out is to test the case. Did you test it? What was
the result?

I can see both possible. I'd peffer to get an arror anout a.dll, but never
tried.
--

Stoitcho Goutsev (100)

"Bart" <Ba**@discussions.microsoft.com> wrote in message
news:A1**********************************@microsof t.com...
Hi,

Imagine the following situation : a.dll depends on b.dll and a.dll is
imported in C# with DllImport["a.dll"].
Is it correct that if b.dll cannot be found, you get an error about a.dll
and *not* about b.dll ?

Thanks,
Bart

--
www.xenopz.com


Mar 20 '06 #5
There is no way for the run-time to know what DLL's are dynamically loaded
by the imported DLL, these are not loaded by the assembly loader, they are
loaded by the OS loader. It's up to the DLL author to report load failures,
but most just test the return value of "LoadLibrary" and just bail out when
the DLL is not found without leaving any trace why it failed, all the
run-time knows is that a load failed with an error code 2 (that is file not
found), but that's all.

Willy.

"Bart" <Ba**@discussions.microsoft.com> wrote in message
news:71**********************************@microsof t.com...
| Hi Stoitcho,
|
| I did test the a.dll - b.dll case. Personally, I think that the (default)
| behaviour is a bit confusing. The run time complains about not finding a
call
| in a.dll, while the actual problem is the absence of b.dll.
| This is particulary annoying while interfacing with matlab : matlab
| instructs to use "dependency walker" to find all dependent dlls. In such a
| case, it would be nice if the run time informs you about missing dlls.
|
| Regards,
| Bart
| --
| www.xenopz.com
|
|
| "Stoitcho Goutsev (100)" wrote:
|
| > Bart,
| >
| > The easiest way to find out is to test the case. Did you test it? What
was
| > the result?
| >
| > I can see both possible. I'd peffer to get an arror anout a.dll, but
never
| > tried.
| >
| >
| > --
| >
| > Stoitcho Goutsev (100)
| >
| > "Bart" <Ba**@discussions.microsoft.com> wrote in message
| > news:A1**********************************@microsof t.com...
| > > Hi,
| > >
| > > Imagine the following situation : a.dll depends on b.dll and a.dll is
| > > imported in C# with DllImport["a.dll"].
| > > Is it correct that if b.dll cannot be found, you get an error about
a.dll
| > > and *not* about b.dll ?
| > >
| > > Thanks,
| > > Bart
| > >
| > > --
| > > www.xenopz.com
| >
| >
| >
Mar 20 '06 #6
Hi Willy,

Thanks for the reply. Do you know any article which documents this
behaviour?

Thanks,
Bart

Apr 2 '06 #7

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

Similar topics

15
by: Jim | last post by:
I am extremely frustrated. I am building c# application for a call center and am using a third party API to access some hardware. When develop and test my class using the windows console the...
9
by: Ole Christensen | last post by:
I'm trying to make a sort of conditional compilation in my C# code because my app is intended to run on both a Pocket PC and on a normal desktop PC. My code uses a call to an API function that on...
3
by: Mark Jerde | last post by:
I'm sill learning VS .NET 2003, not an expert yet. I'm calling an unmanaged C++ DLL from C# using . When the whole project is done I will be calling a total of 5 C++ DLLs from C#. All the DLLs...
2
by: Brian Anderson | last post by:
Hello, is it possible to use DllImport to call a DLL in ASP.NET ? Or is it necessarry that my DLL has to be copied into \System32 ? My DLL is a native C++ 7.1 DLL (not managed, no COM, no...
1
by: elke | last post by:
Hi, I want to use an unmanaged dll in C# .net and I'm having some troubles witch a function that should return an array. I'm new at this, so I don't know what I'm doing wrong. Here is some...
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.