LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Modified a DLL created in labview and now getting labview.lib was not called from a labview process error

I have a dll that I created in a labview about two months ago. Everything with it was working great and I had no issues. I had to a function in the dll today to add an extra parameter. After creating the updated dll I removed the old dll and all references to it from visual studio, and added the new dll. When I run the program when it gets to where it will call the dll it will show the error labview.lib not called... I'm really not sure why replacing the dll is causing the issue when it worked just fine before.

0 Kudos
Message 1 of 21
(3,494 Views)

Just a thought... Did you go from 1 to 2 parameters?

 

With 1 parameter, the calling convention is not significant. With 2 parameters, it is. Those parameters are stacked (on the ip stack), and the order in which that happens is determined by the calling convention.

 

BTW. No idea why you'd get that error, usually you'll get crashes or exceptions.

0 Kudos
Message 2 of 21
(3,461 Views)

Also, the size of the parameters on the stack needs to be correct. If you add a Boolean (1 byte) in c\c++, and a U64 in LabVIEW, the parameter stack will be wrong...

 

You might try giving us a bit more to go on. For example, show the protocol in C\C++ and the one in LabVIEW (or post the VI).

0 Kudos
Message 3 of 21
(3,459 Views)

I went from five parameters to six. Here is the VI that creates the function that is giving me issues. It is only this function that will cause the error. I have another dll that was created in labview that has a function called before this one, and that function is still working find. I did rebuild that dll as well since I read that can fix the issue, but it didn't help it. I added the code to calculate the count and have it outputted.

 

As far as the function it went from:

PicoScope.Calculate_Duty_and_Phase.Calculate_Duty_Cycle_and_Phase_for_Calibration(handle_in, Max_ADC, Duty_A, handle_out, Duty_B, Phase_output)

 

to:

PicoScope.Calculate_Duty_and_Phase.Calculate_Duty_Cycle_Phase_and_Count_for_Calibration(handle_in, Max_ADC, Duty_A, handle_out, Duty_B, Phase_output, count)

0 Kudos
Message 4 of 21
(3,456 Views)

@randomguy77 wrote:

 When I run the program when it gets to where it will call the dll it will show the error labview.lib not called... 


Is this an error out of the CLFN? Or a popup? Does LabVIEW crash then? Or stop running?

 

Maybe a screenshot would help as well, there's usually other stuff on error dialogs (sometimes under "details").

0 Kudos
Message 5 of 21
(3,451 Views)

This is the error message that pops up. Doesn't give me a whole lot of help, and the debug output isn't displaying anything that would hint to what is wrong either.

 

 

 

error message.PNG

0 Kudos
Message 6 of 21
(3,449 Views)

Does LV die after that? Does the VI stop? Or is everything just fine accept the popup?

 

I wander what happens if you put a few messageboxes in the dll. See if LV crashes before, during or after the call.

0 Kudos
Message 7 of 21
(3,443 Views)

Once I click ok the entire program closes. The error message is displayed right when the function gets called.

0 Kudos
Message 8 of 21
(3,438 Views)

And if you revert to the old code (rebuild), it still crashes?

 

Note that it worked before doesn't mean it was good before. The error might be hidden and unexposed before, and a new parameter or even a new build might expose the error.

 

What is the complete prototype of the C++ function, and what does the LabVIEW prototype mention in the configuration dialog of the CLFN? So including the types of the parameters.

0 Kudos
Message 9 of 21
(3,434 Views)

I haven't tried switching back to the old dll and testing that.

 

The prototype is:

Public Shared Sub Calculate_Duty_Cycle_Phase_and_Count_for_Calibration(handle As Short, max_Adc_value As Short, ByRef average_A_Duty As Double, ByRef handle_out As Short, ByRef average_B_Duty As Double, ByRef average_Phase As Double, ByRef count As Integer)

 

in labview the method prototype is:

void Calculate_Duty_Cycle_Phase_and_Count_for_Calibration(I16 handle, I16 Max_Adc_value, out DBL Average_A_Duty, out I16 handle_out, out DBL Average_B_Duty, out DBL Average_Phase, out I32 Count)

 

 

Edit: I removed the code interface node from the VI for calculating the count, and it is now working again. I'm guessing it just didn't link what was needed from that into the dll. I can do the rounding in the text code, so it isn't that important that I need it included in the VI.

0 Kudos
Message 10 of 21
(3,431 Views)