Questions about porting C++ dll to C#

C

chrisben

Hi,

I have some codes in C to do some complex calculation. In order to use it in
C#, I wrap the C codes using C++ and create a unmanged dll, then my program
will call the dll from the C#.

The application has been working ok. However, it is not convenient for me to
debug the codes since after I start the solution, copy the debug dll to the
current foder, my break point cannot step into the codes of that C++ library
even after I include it in the same solution. Later, I found by simply go to
the property of the dll project, change the Use Managed Extensions as Yes,
then I can add the libary to the reference of the C# project, I can recompile
and step into the C++ codes from C# breakpoint.

I changed nothing in C++ library except for that property. It is now easy
for me to debug. However, I start wondering whether this simple change will
impact the performance of my application. Will the app run faster if I change
this property back to No in production? What happened behind the scene after
this change? BTW, I am using VS2003 with framework 1.1.

Thanks

Chrisben
 
M

Mattias Sjögren

The application has been working ok. However, it is not convenient for me to
debug the codes since after I start the solution, copy the debug dll to the
current foder, my break point cannot step into the codes of that C++ library
even after I include it in the same solution.

Did you enable unmanaged code debugging in the project properties?

I changed nothing in C++ library except for that property. It is now easy
for me to debug. However, I start wondering whether this simple change will
impact the performance of my application. Will the app run faster if I change
this property back to No in production?

I think the best way for you to know is to measure it youself.


Mattias
 
C

chrisben

where can i find enable unmanaged code debugging? is that available in vs
2003?
thanks
 
A

Andrew Faust

I have some codes in C to do some complex calculation. In order to use it
in
C#, I wrap the C codes using C++ and create a unmanged dll, then my
program
will call the dll from the C#.

Is it actually necessary for the C++ wrapper? I had thought that you could
create Win32 dlls straight in C. I know this isn't an answer to your
question. It just seems that this might be one less layer for you to
maintain and debug in to.
 
M

Mattias Sjögren

where can i find enable unmanaged code debugging? is that available in vs

Yes. Open the project properties dialog for your C# project. Go to the
Configuration Properties, Debugging category and set the Enable
Unmanaged Debugging property to True.


Mattias
 

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