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.
Solved! Go to Solution.
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:
I´m using a labview 7.1 . The size of array defined on fortran is 100. the dll is attached along all other files.
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.)
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?
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). 😄