Problem calling into managed DLL that calls unmanaged DLL 
Author Message
 Problem calling into managed DLL that calls unmanaged DLL

This has been an interesting foray into managed C++.  If I
need multiple inheritance on a class, I might mix C++ with
C#.

Anyway,

I have one unmanaged C DLL built with VC++6 that is now
called by a managed class in its own assembly.  The
compilation works fine.  However, when I try to
instantiate a object of the managed class in the test
harness, the app will not start up.  In debug mode, I get
the following errors:

--------------------------------------
'AMPLibAdapterCommandLine.exe': Loaded 'C:\Documents and
Settings\Administrator\My Documents\Visual Studio
Projects\AMPLibAdapter\AMPLibAdapterCommandLine\Debug\AMPLi
bAdapterCommandLine.exe', Symbols loaded.
'AMPLibAdapterCommandLine.exe': Loaded 'C:\WINNT\system32
\NTDLL.DLL', Cannot find or open a required DBG file.
'AMPLibAdapterCommandLine.exe': Loaded 'C:\WINNT\system32
\KERNEL32.DLL', Cannot find or open a required DBG file.
'AMPLibAdapterCommandLine.exe': Loaded 'C:\WINNT\system32
\mscoree.dll', No symbols loaded.
'AMPLibAdapterCommandLine.exe': Loaded 'C:\WINNT\system32
\ADVAPI32.DLL', Cannot find or open a required DBG file.
'AMPLibAdapterCommandLine.exe': Loaded 'C:\WINNT\system32
\rpcrt4.dll', Cannot find or open a required DBG file.
'AMPLibAdapterCommandLine.exe':
Loaded 'C:\WINNT\Microsoft.NET\Framework\v1.0.3705
\mscorwks.dll', No symbols loaded.
'AMPLibAdapterCommandLine.exe': Loaded 'C:\WINNT\system32
\USER32.DLL', Cannot find or open a required DBG file.
'AMPLibAdapterCommandLine.exe': Loaded 'C:\WINNT\system32
\GDI32.DLL', Cannot find or open a required DBG file.
'AMPLibAdapterCommandLine.exe':
Loaded 'C:\WINNT\Microsoft.NET\Framework\v1.0.3705
\msvcr70.dll', No symbols loaded.
'AMPLibAdapterCommandLine.exe':
Loaded 'C:\WINNT\Microsoft.NET\Framework\v1.0.3705
\fusion.dll', No symbols loaded.
'AMPLibAdapterCommandLine.exe': Loaded 'C:\WINNT\system32
\SHELL32.DLL', Cannot find or open a required DBG file.
'AMPLibAdapterCommandLine.exe': Loaded 'C:\WINNT\system32
\shlwapi.dll', No symbols loaded.
'AMPLibAdapterCommandLine.exe': Loaded 'C:\WINNT\system32
\msvcrt.dll', No symbols loaded.
'AMPLibAdapterCommandLine.exe': Loaded 'C:\WINNT\system32
\comctl32.dll', Cannot find or open a required DBG file.
'AMPLibAdapterCommandLine.exe':
Loaded 'C:\WINNT\Microsoft.NET\Framework\v1.0.3705
\mscorlib.dll', No symbols loaded.
'AMPLibAdapterCommandLine.exe': Loaded 'C:\WINNT\system32
\OLE32.DLL', Cannot find or open a required DBG file.
'AMPLibAdapterCommandLine.exe':
Loaded 'C:\WINNT\Microsoft.NET\Framework\v1.0.3705
\diasymreader.dll', No symbols loaded.
'DefaultDomain':
Loaded 'c:\winnt\microsoft.net\framework\v1.0.3705
\mscorlib.dll', No symbols loaded.
'AMPLibAdapterCommandLine.exe':
Loaded 'C:\WINNT\Microsoft.NET\Framework\v1.0.3705
\mscorsn.dll', No symbols loaded.
'AMPLibAdapterCommandLine.exe':
Loaded 'C:\WINNT\Microsoft.NET\Framework\v1.0.3705
\mscorjit.dll', No symbols loaded.
'AMPLibAdapterCommandLine': Loaded 'c:\Documents and
Settings\Administrator\My Documents\Visual Studio
Projects\AMPLibAdapter\AMPLibAdapterCommandLine\Debug\AMPLi
bAdapterCommandLine.exe', Symbols loaded.
An unhandled exception of
type 'System.IO.FileNotFoundException' occurred in Unknown
Module.

Additional information: File or assembly name
AMPLibAdapter, or one of its dependencies, was not found.
-----------------------------------------

Now this seems to indicate that the DBG files for the
system Win32 APIs are missing, perhaps because the C DLL
is built in VC++6 and I am using VC++.NET.  But I don't
think so.  The release build produces the following error:

-----------------------------------------------
Unhandled Exception: System.IO.FileNotFoundException: File
or assembly name AMPL
ibAdapter, or one of its dependencies, was not found.
File name: "AMPLibAdapter"
   at main()

Fusion log follows:
=== Pre-bind state information ===
LOG: DisplayName = AMPLibAdapter, Version=1.0.1084.17075,
Culture=neutral, Publi
cKeyToken=null
 (Fully-specified)
LOG: Appbase = C:\Documents and Settings\Administrator\My
Documents\Visual Studi
o Projects\AMPLibAdapter\Release\
LOG: Initial PrivatePath = NULL
Calling assembly : AMPLibAdapterCommandLine,
Version=1.0.1084.19472, Culture=neu
tral, PublicKeyToken=null.
===

LOG: Application configuration file does not exist.
LOG: Policy not being applied to reference at this time
(private, custom, partia
l, or location-based assembly bind).
LOG: Post-policy reference: AMPLibAdapter,
Version=1.0.1084.17075, Culture=neutr
al, PublicKeyToken=null
LOG: Attempting download of new URL file:///C:/Documents
and Settings/Administra
tor/My Documents/Visual Studio
Projects/AMPLibAdapter/Release/AMPLibAdapter.DLL.
------------------------------------------------------

This one tells me something different, like the managed
code is having trouble accessing the unmanaged DLL, like
there some .NET configuration not set.

I have located a .NET configuration document set, but it
is not specific to unmanaged DLLS and I am getting a
little cloudy in judgement.  Can someone point me in the
right direction?

Thanks.

Bill Sayles



Wed, 08 Jun 2005 00:22:57 GMT  
 Problem calling into managed DLL that calls unmanaged DLL

Quote:

..
> I have one unmanaged C DLL built with VC++6 that is now
> called by a managed class in its own assembly.  The
> compilation works fine.  However, when I try to
> instantiate a object of the managed class in the test
> harness, the app will not start up.  In debug mode, I get
> the following errors:
[snip]

> Additional information: File or assembly name
> AMPLibAdapter, or one of its dependencies, was not found.
> -----------------------------------------
[snip]
> think so.  The release build produces the following error:

> -----------------------------------------------
> Unhandled Exception: System.IO.FileNotFoundException: File
> or assembly name AMPL
> ibAdapter, or one of its dependencies, was not found.
> File name: "AMPLibAdapter"
>    at main()

> Fusion log follows:
[snip]

> This one tells me something different, like the managed
> code is having trouble accessing the unmanaged DLL, like
> there some .NET configuration not set.

> I have located a .NET configuration document set, but it
> is not specific to unmanaged DLLS and I am getting a
> little cloudy in judgement.  Can someone point me in the
> right direction?

> Thanks.

> Bill Sayles

I don't think that the error you are seeing is related to the presence of
the unmanaged dll. The logs provided suggest that your main program is
unable to find the AMPLibAdapter assembly. This may be related to how your
program is installed (or not installed) into the Global Assembly Cache
(GAC). Or you may need a configuration file for the AMPLibAdapter assembly.

I have not been able to reproduce the problem you are seeing, so I don't
have a more concrete answer for you. Can you provide a more detailed repro
case?

--
Mark Levine
Visual C++ Team
This posting is provided "AS IS" with no warranties, and confers no
rights.



Tue, 05 Jul 2005 03:11:32 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Calling a Managed DLL from and UnManaged DLL

2. Managed C++ call unmanaged DLL error

3. Calling function in managed dll from Unmanaged MFC Application doesn't work on XP

4. How to call managed C++ DLL from unmanaged C++ EXE

5. Unmanaged C++ calling managed C# dll

6. C# client crashs when calling into Managed C++ which calls unmanaged c++ function

7. VC6 DLL calls VB6 DLL calls back to VC6 DLL: Occasional GPF or ‘Bad DLL calling convention'

8. Calling an unmanaged DLL function that uses a std::string parameter

9. Call C# dll from unmanaged C++

10. Unmanaged DLL calling a C# class

11. Web service calling unmanaged DLL won't work

12. Calling "unmanaged" com dll from c#

 

 
Powered by phpBB® Forum Software