Hello, I'm new to LabVIEW and relatively new to Fortran as well. I'm currently attempting to use the "Call Library Function Node" to use a Fortran .dll that I have written. I'm passing several values into the library node and would like to see them updated by the subroutine I've selected so that they will come out the other side of the node with new values.
Currently, when running the VI, I receive an error "Error 1097 occurred at Call Library Function Node in MyDllTest.vi". I've tried selecting both types of calling conventions, but it doesn't seem to make a difference. Also, the values that I input into the dll block simply come out the other side untouched. I am able to pick my subroutine as an option when setting up the dll node, but I've had to add all of the variables manually. I'm not sure if that's correct behavior or not.
I have attached both my .vi and my Fortran code.
The error is saying that there is something wrong with your fortran code. I would check your data types. I don't know if fortran considers a logical to be an integer.
There is an example on this page you might find useful:
Lastly, filling in the parameters yourself is expected for this type of dll.
Thank you for your response. That forum post is actually the guideline that I was going by when I started this project. In order to check the fortran code, I went so far as to write a main function and compile it as an executable. It compiled and ran succesfully.
As far as the logical to integer conversion goes, I couldn't find a "Type" in the call library function parameter settings that corresponded to bool or logical or anything such as that. Integer was the closest type I could find, and some other user recommended it as well. Maybe that is where the problem lies though, and I may need to use some other data type to represent my logical.
Could you change the logical it to an integer in your fortran just to double check whether that is the problem?
Also, you might try parsing down your subroutine to just a couple of values and work up from there.
Let me know how it goes.
I may try that, but for now, I actually tried passing the boolean as "Adapt to Type". That has gotten rid of the error, though the code still doesn't function as intended. I'll look at it for a while and let you know what I figure out.
I've been working at this today, and I seem to have it working aside from the boolean. I simply took the boolean out of the Fortran and the vi and everything worked fine. Apparently, I've yet to find the appropriate way to designate a Fortran boolean variable in the call library function node.
Good morning adams156,
I think that how booleans are stored is specific to each language, you would have to track it down for your version of Fortran. It might be easier just to store it as an integer. The discussion below hits on this for c:
I think I finally have it! I start off with a boolean in the .vi which I then type cast to a 4 byte signed integer (turns out that's what a default fortran logical is), and feed that into the call library node, which is expecting a 4 byte signed integer. Everything seems to be working great now. Thanks for your help.
Good to hear!
Would you mind posting your working example so other people who come across this thread can use it?