Problem in debuging unmanaged code 
Author Message
 Problem in debuging unmanaged code

I have one MFC regular DLL (Not COM DLL) built under VC++. Recently, I
ported it to VC 7.0 (within VS.Net). I also provided one managed c++ wrapper
class in this DLL to help C# call some functions defined in this DLL.

Now I got 2 problems described below.
(1) I can debug the c# client application and MC++ class defined in the DLL,
but I cannot debug into unmanaged code through MC++ wrapper function.
Instead, it just return the result from unmanaged function call. How can I
debug into unmanaged code?

(2) After did one times debug, I decided to modify some code in MC++ wrapper
class. After that, I cannot link the DLL anymore. It told me that the DLL
cannot be opened. I tried to use "File Explorer" to delete that DLL, but I
cannot. The message said that DLL is shared by other program. I have to
close the whole solution , then reload the solution to solve the "File
Sharing" problem. This problem never happened in VC++ 6.0, because the DLL
is just regular MFC DLL.
Anybody can help me to solve this problem.

Thanks

Mike zhao



Sun, 27 Jun 2004 14:43:51 GMT  
 Problem in debuging unmanaged code
Hi Mike,
To do both Managed and Native(unmanaged) debugging, right click on the
project node of your solution, select Properties, then in General tree node
click Debugging, and under De{*filter*}s the De{*filter*} Type needs to be changed
to "Mixed". You will notice some performance slowdown especially with very
large projects which use a lot of both managed and unmanaged classes.
For the second question, make sure that any process which is using that dll
is totally dead, since if a process lingers beyond when the ui is gone the
dll will still be referenced and the operating system will lock the binary
so that it doesnt get overwritten.

--
regards,
Robert Svilpa
Software Design Engineer in Test
Managed Extensions for C++
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. ? 2001 Microsoft Corporation. All rights
reserved.


Quote:
> I have one MFC regular DLL (Not COM DLL) built under VC++. Recently, I
> ported it to VC 7.0 (within VS.Net). I also provided one managed c++
wrapper
> class in this DLL to help C# call some functions defined in this DLL.

> Now I got 2 problems described below.
> (1) I can debug the c# client application and MC++ class defined in the
DLL,
> but I cannot debug into unmanaged code through MC++ wrapper function.
> Instead, it just return the result from unmanaged function call. How can I
> debug into unmanaged code?

> (2) After did one times debug, I decided to modify some code in MC++
wrapper
> class. After that, I cannot link the DLL anymore. It told me that the DLL
> cannot be opened. I tried to use "File Explorer" to delete that DLL, but I
> cannot. The message said that DLL is shared by other program. I have to
> close the whole solution , then reload the solution to solve the "File
> Sharing" problem. This problem never happened in VC++ 6.0, because the DLL
> is just regular MFC DLL.
> Anybody can help me to solve this problem.

> Thanks

> Mike zhao



Mon, 28 Jun 2004 03:49:26 GMT  
 Problem in debuging unmanaged code
Hi, Robert

Thanks for your help. For the second question. I still have problem.
(1) How can I check my DLL is used by other applications? Is there any tool
to help me to do that?
(2) Except for the VS.Net enviroment, I didn't lunch any other application.
When I finish the debug, I should be allowed to delete that DLL, but I
cannot. This doesn't happen in VC++ 6.0. I have to unload the DLL project,
then load it again to solve the "file delete" problem.

Any further suggestion on this?

Thanks

Mike zhao



Quote:
> Hi Mike,
> To do both Managed and Native(unmanaged) debugging, right click on the
> project node of your solution, select Properties, then in General tree
node
> click Debugging, and under De{*filter*}s the De{*filter*} Type needs to be changed
> to "Mixed". You will notice some performance slowdown especially with very
> large projects which use a lot of both managed and unmanaged classes.

> For the second question, make sure that any process which is using that
dll
> is totally dead, since if a process lingers beyond when the ui is gone the
> dll will still be referenced and the operating system will lock the binary
> so that it doesnt get overwritten.

> --
> regards,
> Robert Svilpa
> Software Design Engineer in Test
> Managed Extensions for C++
> Microsoft Corporation

> This posting is provided "AS IS" with no warranties, and confers no
rights.
> You assume all risk for your use. ? 2001 Microsoft Corporation. All rights
> reserved.



> > I have one MFC regular DLL (Not COM DLL) built under VC++. Recently, I
> > ported it to VC 7.0 (within VS.Net). I also provided one managed c++
> wrapper
> > class in this DLL to help C# call some functions defined in this DLL.

> > Now I got 2 problems described below.
> > (1) I can debug the c# client application and MC++ class defined in the
> DLL,
> > but I cannot debug into unmanaged code through MC++ wrapper function.
> > Instead, it just return the result from unmanaged function call. How can
I
> > debug into unmanaged code?

> > (2) After did one times debug, I decided to modify some code in MC++
> wrapper
> > class. After that, I cannot link the DLL anymore. It told me that the
DLL
> > cannot be opened. I tried to use "File Explorer" to delete that DLL, but
I
> > cannot. The message said that DLL is shared by other program. I have to
> > close the whole solution , then reload the solution to solve the "File
> > Sharing" problem. This problem never happened in VC++ 6.0, because the
DLL
> > is just regular MFC DLL.
> > Anybody can help me to solve this problem.

> > Thanks

> > Mike zhao



Mon, 28 Jun 2004 09:55:29 GMT  
 Problem in debuging unmanaged code
Hi Mike,
There might be some kind of issue where your application has a class which
is still{*filter*} around on the managed heap waiting for garbage collection
to occur. When you kill your application, any memory or class information in
memory which relies on the library loaded in memory will cause you to have
this issue... This is about the only thing I can think of, except if there
is a thread inside either the managed or unmanaged code which hasnt been
destroyed...

as for checking to see if other apps are loading the dll, I cant provide you
with a definitive answer right now. Let me check into this more carefully,
since I dont believe this is a realistic issue in itself. Only the threading
issue would be a possibility, and if it's unmanaged you should be querying
the os to ensure that all threads off of the main process are killed before
you exit the application.

--
regards,
Robert Svilpa
Software Design Engineer in Test
Managed Extensions for C++
Microsoft Corporation

This posting is provided "AS IS" with no warranties, and confers no rights.
You assume all risk for your use. ? 2001 Microsoft Corporation. All rights
reserved.


Quote:
> Hi, Robert

> Thanks for your help. For the second question. I still have problem.
> (1) How can I check my DLL is used by other applications? Is there any
tool
> to help me to do that?
> (2) Except for the VS.Net enviroment, I didn't lunch any other
application.
> When I finish the debug, I should be allowed to delete that DLL, but I
> cannot. This doesn't happen in VC++ 6.0. I have to unload the DLL project,
> then load it again to solve the "file delete" problem.

> Any further suggestion on this?

> Thanks

> Mike zhao



> > Hi Mike,
> > To do both Managed and Native(unmanaged) debugging, right click on the
> > project node of your solution, select Properties, then in General tree
> node
> > click Debugging, and under De{*filter*}s the De{*filter*} Type needs to be
changed
> > to "Mixed". You will notice some performance slowdown especially with
very
> > large projects which use a lot of both managed and unmanaged classes.

> > For the second question, make sure that any process which is using that
> dll
> > is totally dead, since if a process lingers beyond when the ui is gone
the
> > dll will still be referenced and the operating system will lock the
binary
> > so that it doesnt get overwritten.

> > --
> > regards,
> > Robert Svilpa
> > Software Design Engineer in Test
> > Managed Extensions for C++
> > Microsoft Corporation

> > This posting is provided "AS IS" with no warranties, and confers no
> rights.
> > You assume all risk for your use. ? 2001 Microsoft Corporation. All
rights
> > reserved.



> > > I have one MFC regular DLL (Not COM DLL) built under VC++. Recently, I
> > > ported it to VC 7.0 (within VS.Net). I also provided one managed c++
> > wrapper
> > > class in this DLL to help C# call some functions defined in this DLL.

> > > Now I got 2 problems described below.
> > > (1) I can debug the c# client application and MC++ class defined in
the
> > DLL,
> > > but I cannot debug into unmanaged code through MC++ wrapper function.
> > > Instead, it just return the result from unmanaged function call. How
can
> I
> > > debug into unmanaged code?

> > > (2) After did one times debug, I decided to modify some code in MC++
> > wrapper
> > > class. After that, I cannot link the DLL anymore. It told me that the
> DLL
> > > cannot be opened. I tried to use "File Explorer" to delete that DLL,
but
> I
> > > cannot. The message said that DLL is shared by other program. I have
to
> > > close the whole solution , then reload the solution to solve the "File
> > > Sharing" problem. This problem never happened in VC++ 6.0, because the
> DLL
> > > is just regular MFC DLL.
> > > Anybody can help me to solve this problem.

> > > Thanks

> > > Mike zhao



Mon, 28 Jun 2004 10:31:25 GMT  
 Problem in debuging unmanaged code
HI, Robert

For the first question, I set the project Debug type to "Mixed", then
rebuilt the whole project, but I still cannot debug into unmanaged code in
DLL, of course there is no problem to debug the managed code in DLL.

Any more idea on this problem? or you may provide one simple example to help
me try that in my site?

Thanks

Mike zhao



Quote:
> Hi Mike,
> To do both Managed and Native(unmanaged) debugging, right click on the
> project node of your solution, select Properties, then in General tree
node
> click Debugging, and under De{*filter*}s the De{*filter*} Type needs to be changed
> to "Mixed". You will notice some performance slowdown especially with very
> large projects which use a lot of both managed and unmanaged classes.

> For the second question, make sure that any process which is using that
dll
> is totally dead, since if a process lingers beyond when the ui is gone the
> dll will still be referenced and the operating system will lock the binary
> so that it doesnt get overwritten.

> --
> regards,
> Robert Svilpa
> Software Design Engineer in Test
> Managed Extensions for C++
> Microsoft Corporation

> This posting is provided "AS IS" with no warranties, and confers no
rights.
> You assume all risk for your use. ? 2001 Microsoft Corporation. All rights
> reserved.



> > I have one MFC regular DLL (Not COM DLL) built under VC++. Recently, I
> > ported it to VC 7.0 (within VS.Net). I also provided one managed c++
> wrapper
> > class in this DLL to help C# call some functions defined in this DLL.

> > Now I got 2 problems described below.
> > (1) I can debug the c# client application and MC++ class defined in the
> DLL,
> > but I cannot debug into unmanaged code through MC++ wrapper function.
> > Instead, it just return the result from unmanaged function call. How can
I
> > debug into unmanaged code?

> > (2) After did one times debug, I decided to modify some code in MC++
> wrapper
> > class. After that, I cannot link the DLL anymore. It told me that the
DLL
> > cannot be opened. I tried to use "File Explorer" to delete that DLL, but
I
> > cannot. The message said that DLL is shared by other program. I have to
> > close the whole solution , then reload the solution to solve the "File
> > Sharing" problem. This problem never happened in VC++ 6.0, because the
DLL
> > is just regular MFC DLL.
> > Anybody can help me to solve this problem.

> > Thanks

> > Mike zhao



Mon, 28 Jun 2004 12:14:48 GMT  
 Problem in debuging unmanaged code


Quote:
> Hi Mike,
> There might be some kind of issue where your application has a class which
> is still{*filter*} around on the managed heap waiting for garbage collection
> to occur.

That's funny.  You gotta love .NET.  It's so good, everybody is going to use
it!  At least that's what the MS propaganda would have you believe.  On the
other hand, see something like this:
http://www.*-*-*.com/

-Michael Viking



Mon, 28 Jun 2004 22:39:25 GMT  
 
 [ 6 post ] 

 Relevant Pages 

1. Managed c++ with unmanaged code Linking problem...

2. Problem with Visual Studio .NET (C++) - Maximise Speed (/O2) - Unmanaged Code

3. problem of unmanaged exception in managed code C++

4. Referencing data from unmanaged code to managed code in C++ Wrapper class

5. calling managed code from unmanaged code

6. Calling managed code from unmanaged Code

7. Problem on Debuging ISAPI Filter

8. softice debuging problem

9. problem with debuging in BC++ 3.0

10. Debugging into managed c++ DLL that is being used by unmanaged code

11. Testing Abort flag in unmanaged code.

12. Working with UnManaged Code

 

 
Powered by phpBB® Forum Software