Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Why Cant I debug an extern C function in my Project?

Posted on 2009-05-07
6
Medium Priority
?
280 Views
Last Modified: 2012-05-06
Im developing a windows application (not web-based) using Visual Studio 2008 and Visual C#.

One of the projects within the solution builds into a DLL. One of the source files of this DLL contains a function as shown below;

extern "C" __declspec(dllexport) double* getTriggerWaveform_DLL(long channelNo, long noOfPoints, double* timeIncrement, double* startTime) throw(exception)
{
   // sample code
   int a = 2;
   a = a + 2;
}


Im trying to debug my solution but I am not being allowed to set a breakpoint in the code within this function. Instead I get the following message

"The breakpoint will not currently be hit. No symbols have been loaded for this document."

When I select the solution then do Project->Properties->Configuration Properties I note that the Platform for the DLL is set as "Win32" whereas all the other projects in the solution have Platform set to "Any CPU". Im not sure if that is significant.

Also note that Build is set to "Debug" for all the projects in the solution so that is not the reason.

I really need to be able to debug this function because my application hangs somewhere inside it !

Any ideas?
0
Comment
Question by:rangers99
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
6 Comments
 
LVL 16

Accepted Solution

by:
CuteBug earned 500 total points
ID: 24324398
When you try to attach to a process, Visual studio displays a dialog titled "Attach To Process"

1. Select the process you want to attach to.
2. In that dialog, in the "Attach To" section, there is a button called "Select". Click on that.
3. It shows up a new dialog.
4. Select the "Debug these code types" radio box.
5. From the list, select "Managed" and "Native".
6. Click OK.
7. Click Attach.
8. Now you should be able to set a breakpoint in your dll.


0
 

Author Comment

by:rangers99
ID: 24324880
CuteBug

Thanks for the reply.

Unfortunately I don' understand what you mean you say "Select the process you want to attach to". By process do you mean the DLL.
0
 
LVL 16

Expert Comment

by:CuteBug
ID: 24325005
When you start the application which uses your DLL, that application will be listed in the Attach to Process dialog.
Select that process...

By the way you must attach before your application call the DLL's method.
One way to do this is to add a MessageBox.Show("Attach"); before your DLL's method is called.

Once you have attached the debugger to the process, then you can click Ok on the message box that is displayed.
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 

Author Comment

by:rangers99
ID: 24325229
CuteBug

Thanks I tried that. Unfortunatley the process is greyed out and has a type of "Managed" (all the other processes listed have type x86). The "Attach" button is disabled for my process and I cant attach the debugger. Any way round this?
0
 
LVL 16

Expert Comment

by:CuteBug
ID: 24334902
Hi,
Sorry for the late reply.

If the process appears greyed out in your Attach to Process dialog, it means that you have already attached to that process.
(Could you please show a screenshot of the Attach to Process Dialog to confirm this?)

If that is the case then you can detach the process (the option is under Debug menu).

Now attach again using the method described in my previous comment.
0
 

Author Comment

by:rangers99
ID: 24336509
Fantastic, thanks Cutebug
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Examines three attack vectors, specifically, the different types of malware used in malicious attacks, web application attacks, and finally, network based attacks.  Concludes by examining the means of securing and protecting critical systems and inf…
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use nested-loops in the C programming language.

610 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question