From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
03-30-2011 11:09 AM
Hello!!I´m having problems to link a fortran code in labview. When i use a simple integer or real number, the program works. But when i use a array the labview crashes. Actually i´m using the "library function node" to call the fortran dll and the GFORTRAN compiler for windows. I don´t know where´s the problem. I read some discussions about it but nobody offers a solution.
Please Help!!!
Solved! Go to Solution.
03-30-2011 11:29 AM
Is the array an input or output?
How is the terminal in the call library node configured?
Feel free to attach your LabVIEW code and dll.
03-30-2011 11:38 AM
ok, i wrote a simple code
And i tested a lot of diferents trivials programs to test. But the problem arrive when i try to manage the array inside the fortran compiler
My library functions node is configured like this:
Any help?
Thanks
03-30-2011 11:46 AM
03-30-2011 11:55 AM
I´m using a labview 7.1 . The size of array defined on fortran is 100. the dll is attached along all other files.
Thanks
03-30-2011 12:48 PM
Try:
03-30-2011 01:15 PM - edited 03-30-2011 01:18 PM
In addition to Saverio's advice, you seem to actually deal with SGL in the fortran DLL because of coding mistakes.
So: Change the representation in the call library setup to "4byte single" and wire a SGL array of the correct size to the input and you actually get a 10 as first element. (with DBL you get something ~1e300+)
(To retain DBL precision, you need to change compile options or write "A(1) = 10.D0" in the fortran code.)
03-30-2011 01:19 PM
Ok, thanks. It´s works for me. But the array that I enter is already done. How can i modify the elements of the array to do a operation?
03-30-2011 01:32 PM - edited 03-30-2011 01:32 PM
You would wire it to the input, but you need to make sure it has the correct size. For safety, you could insert a "reshape array" with the correct size. This will pad or trim to what the dll expects. You could also wire the size as an additional variable.
About the single precision fallback: it really depends on the compiler and the compile options. For example in Intel fortran, compiling with IA32 will use DBL but compiling with SSE3 options would cause a fallback to SGL unless we use an addtional compile option ("/real_size:64") .
I have investigated these issues in detail a while ago, have a look at some of the answers from the experts.
(LabVIEW is much nicer, because if always coerces to the richer representation with mixed operations). 😄
03-30-2011 01:39 PM
Ok, Thank you so much. You made my life as much easier.