LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

error 1097 in call library function

Hi Guenter Mueller

 

I can not uderstand why all the time when i run the program , the error as i described above occurs again and again.

The error is mentioned in the error.doc file which is attached in the above post.

 

Please any other volunteer look into this. 

0 Kudos
Message 21 of 34
(1,519 Views)

mhs100 wrote:
Hi Guenter Mueller

 

I can not uderstand why all the time when i run the program , the error as i described above occurs again and again.

The error is mentioned in the error.doc file which is attached in the above post.

 

Please any other volunteer look into this. 


There are several possible reasons:

 

1) Your CallLibrary Node is not configured properly. Calling convention,number of parameters, parameter types and size of parameters.

2) Size of parameters is especially important. If you pass in a buffer for the DLL to write data in, this buffer needs to be preallocated in the correct size before passing it o the CLN.

3) another possibility is simply that you have a bug in your DLL.

 

And ooh before I forget, I do not open doc files from strangers.

Message Edited by rolfk on 10-20-2009 12:54 AM
Rolf Kalbermatter
My Blog
Message 22 of 34
(1,507 Views)

Hi Rfolk

 

You have given a general answer. I have checked all of the things which you have mentioned like calling convention ,

number of parameters , data types etc.

 

Please check the coding of dll in mhsdlldef.zip in post number 17 and reply to post number 20 and please also check the mhsVI.zip also.

 

 

  

0 Kudos
Message 23 of 34
(1,494 Views)

mhs100 wrote:

Hi Rfolk

 

You have given a general answer. I have checked all of the things which you have mentioned like calling convention ,

number of parameters , data types etc.

 

Please check the coding of dll in mhsdlldef.zip in post number 17 and reply to post number 20 and please also check the mhsVI.zip also.

 

 

 


Well some code simply doesn't deserve much time. Your VI has no data dependency at all. How do you hope that your LoadDLL() is executed BEFORE any of the other functions????? There is a 1 to 5 chance that it won't, making LabVIEW call into functions which try to call invalid function pointers. So my point 3 already applies.

 

After such an obvious error like this I have absolutely no interest in checking the entire DLL for parameter errors or anything else. Also it is your DLL not mine so please be a bit more polite about requesting me what to do.

 

Also I don't like code sprinkled with global variables. My problem I know but it just turns me off.

Message Edited by rolfk on 10-20-2009 08:11 AM
Rolf Kalbermatter
My Blog
Message 24 of 34
(1,487 Views)

Hi Rfolk

 

Thanks for your suggestion. You are absolutely Right. Actually i am visual C++ and labview novice. I am doing this for the first time but please , please tell me how to call load library function first and other functions in the sequential order

 

This is the reason why i am asking every one to look into my dll code and tell me if there is any error . I want help from the labview professionals like you in tracing out the error.

 

Please help me .  

Message Edited by mhs100 on 10-20-2009 01:24 AM
0 Kudos
Message 25 of 34
(1,483 Views)

I am sorry

 

In second line it is not load library function , it is LoadDLL() function

0 Kudos
Message 26 of 34
(1,476 Views)

You should really look for some references about dataflow programming. Dataflow is what defines the execution order in LabVIEW. If you do not have any dataflow such as with your intilialization functions you can cause a sequential operation by using the ... exactly, Sequence Structure.

 

Now since you are a newbie and can be educated a bit: Sequence Structures are in general bad, especially the stacked one. It hides code and makes thing hard to overview. The parallel Sequence Structure has that problem at least not, but it is still a cludge for most practical uses.

 

The proper way is to put all your little Call Library Nodes into subVIs, add proper error handling to all of them (input error cluster, not executing anything if that cluster indicates an incoming error except for the close function which always should attempt to close but needs of course protection so that it does not crash if the DLL never has been initialized (check of the close function pointers to be valid), then if the function returns an error (and does not exit(1) as it does now) evaluate that error and put it in the error out cluster, and last but not least wire those VIs together, with the error cluster being the natural data flow.

 

Your use of exit(1) is VERY bad for a DLL. This will tear down the entire application, looking like a crash. Instead, make the functions return an error code, with 0 if everything was ok and another value if something went wrong.

Rolf Kalbermatter
My Blog
Message 27 of 34
(1,476 Views)

Hi Rfolks

 

Thanks for your advice. At the start of this thread , i mentioned my application that i am trying to communicate

with usb daq card from labview. I have a dll file which is mpusbapi.dll . This dll is of microchip and it uses C calling convention . I am sending you one more VI . which calls mpusbapi.dll and this VI uses stacked sequence structure.

As you said before it calls SUB VIs

 

This VI does not give any error. When i run this VI , it tries to communicate with my usb daq but stops within a second.

 

The question i want to ask is that

 

 How i can write  1)pwm output value to this VI?. 2) Digital output value ? I want to control my daq outputs from front panel.

 

How i can read 1) Analog inputs from this VI and show them on front panel? 2) Read  digital inputs?

 

The main VI is VIDriver3

 

Please tell me. Attached is the VI.

 

Any help greatly appreciated.

Message Edited by mhs100 on 10-20-2009 03:14 AM
0 Kudos
Message 28 of 34
(1,465 Views)

Hi

 

For other volunteers

 

Please check the VI i send in message 28 and my problem is also defined in this message. Also look at the code in mhsdlldef.zip file in message number 17. In that code i wrote some functions in mhs.cpp which are as follows

 

SalidasdigitalesbyteTAD() for digital output

salidasanalogicasTAD () for pwm output

entradas analogicasTAD() for analog inputs

entradasdigitalesTAD() for digital inputs

 

Now after going through this , please tell me how to implement these functions with the VI i send in message 28.

 

Any help is appreciated. 

0 Kudos
Message 29 of 34
(1,455 Views)
Please anyone look into this. Do i send my controller code also?
0 Kudos
Message 30 of 34
(1,443 Views)