DllImport

G

Guest

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
 
S

scott blood

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
 
S

Stoitcho Goutsev \(100\)

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.
 
G

Guest

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 said:
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 said:
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
 
G

Guest

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) said:
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 said:
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
 
W

Willy Denoyette [MVP]

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.

| 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)
| >
| > | > > 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
| >
| >
| >
 
B

bart_deboeck

Hi Willy,

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

Thanks,
Bart
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top