09-13-2018 01:02 PM
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.
09-14-2018 07:04 AM - edited 09-14-2018 07:06 AM
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.
09-14-2018 07:09 AM
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).
09-14-2018 07:28 AM - edited 09-14-2018 07:30 AM
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)
09-14-2018 07:34 AM
@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").
09-14-2018 07:46 AM - edited 09-14-2018 07:47 AM
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.
09-14-2018 09:17 AM
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.
09-14-2018 09:42 AM
Once I click ok the entire program closes. The error message is displayed right when the function gets called.
09-14-2018 09:55 AM
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.
09-14-2018 10:22 AM - edited 09-14-2018 10:29 AM
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.