LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Debugging a c++ dll from visual studio 2010

Solved!
Go to solution

Hi everybody

I'm extending and optimizing a c++ dll that is called in a labview file. I have managed to get it update and running but it's not doing what is supposed to :(.

I need to debug it by setting break point in the c++ code because the labview part is just memory and display. How I can do that? Any help will be really appreciated 🙂

I'm using labview 2012 and VS210 express.

Tanks a lot

Amos

i attached the main file of the dll and the labview interface.

Download All
0 Kudos
Message 1 of 14
(5,029 Views)

Go:

 

Visual studio -> Project -> Properties, select Debug mode as active, go -> Configuration properties -> Debugging -> Command, click browse, select LabView

 

Close LabView if opened

 

Select Debug mode, hit F5, click OK, wait for LabView to start, select your VI to run, create breakpoint in DLL code, run VI, the code should break.

 

ps. Are you serious with that VI and DLL ? That is the function with most arguments and a VI with biggest while loop 🙂

Message 2 of 14
(5,024 Views)

Thanks for the replay Bulbina

I'm not able to do what you say Smiley Sad because I'm not able to find labview while I browse because VS search for .exe. I have to convert the Labview part in an exe?

ps. I agree the function and the while are ridiculous, and consider that right now they are about a tenth of what they were before I got my hand on them Smiley Happy

Have a nice day

 

0 Kudos
Message 3 of 14
(4,999 Views)

Select Labview, that means you select Labview.exe

 

C:\Program files\National Instruments\LabView XXXX\LabView.exe

 

The whole process (simplified)

 

You tell VS this way that labview is the process, that will call your DLL.

You start LabView in VS as a process you want to debug, after there is a call to a code that was built with debug info, Visual studio is able to give you debugging capability.

 

 

Message 4 of 14
(4,996 Views)

It's still not working but is closer to success in debugging i seen in weeks 🙂 now i can compile whit out deleting the dll path from labview.

Now the problem is that is ingoring the break point in the dll 😞 . I know that i'm abusing your patient but please help me a little bit more.

thanks a lot bulbina

 

0 Kudos
Message 5 of 14
(4,990 Views)

To be honest, your DLL is weird.

 

Why do you have a main function in DLL?!?! DLL has an entrypoint defined in dllmain.c / cpp, delete it or comment it.

 

If you cannot trigger a breakpoint, there might be several reasons for that.

Check you are running the Debug configuration, check you are calling the proper (the just built) DLL, and put a breakpoint in the first statement.

I see switch statement, so you might just have a breakpoint in code that isnt executed.

 

On top of all that, if you are allready using labview, if I were you, I would recode the DLL into LabView. Your are not using anything out of LabView scope, just math functions.

Even if the DLL function has 200 rows, you can do this in 50 rows or few hour LabViewing.

 

 

 

0 Kudos
Message 6 of 14
(4,985 Views)

I have deleted the main, and as far as i can see ( so means see that everything says debug, i'm in local system should i switch to remote?) the configurations is fine. the strange things is that he keep asking me to compile the file when i start the debug even if i just do it. i'm sure i'm calling the right dll 🙂 and i have set break point everywhere but still nothing. i tried to run labview step to step but it isn't helping. in labview the dll node debug proprety is set to maximum.

i send you the adjurned dll

Download All
0 Kudos
Message 7 of 14
(4,976 Views)
Solution
Accepted by topic author Amos88

So,

 

LabView is off,

 

You press F5 in your visual studio, this starts LabView, it tells you LabView was not built with debug, you click yes. LabView starts.

Now you select your VI, open the Call library function node and check you have selected the proper DLL.

You start your VI, it is running and jumps into Call library function node. If you do not get triggered breakpoint now, you either have not built the dll with debug info or use wrong dll.

 

No more help possible to deliver.

 

And OMG get rid of that main function, even if it is empty !

Message 8 of 14
(4,973 Views)

Ok i'm going to reconstruct pice by pice all the function 🙂 the file is still not working but i create a new test dll and whit that one the debug run just fine. Thanks a lot

Amos

0 Kudos
Message 9 of 14
(4,961 Views)

It is good to know, that if you specify "Attach to process" in debugging project properities, you can attach LabView, so you do not need to turn it off and on.

0 Kudos
Message 10 of 14
(4,959 Views)