Origin Ver. and Service Release: OriginPro2015 (64-bit) Sr1
Operating System: Windows 7 64-bit
Hello!
I want to use fortran function in OriginLab. As I understand fortran code can be used in originlab via OriginC and dll from Fortan code.
For example, I made test.f90 with simple function:
REAL(8) FUNCTION SUMFT(A, B)
!DEC$ ALIAS SUMFT, "SUMFT"
!DEC$ ATTRIBUTES DLLEXPORT:: SUMFT
!DEC$ ATTRIBUTES VALUE :: A
!DEC$ ATTRIBUTES VALUE :: B
REAL(8) A
REAL(8) B
SUMFT = A + B
END
I made test.dll from fortran code via gfortran in cmd:
gfortran -c test.f90
gfortran -shared -mrtd -o test.dll test.o
and tried to call function in OriginC to according to instructions:
https://www.originlab.com/doc/OriginC/guide/Calling-Third-Party-DLL-Functions
I made test.c:
#include <Origin.h>
#include "test.h"
#pragma labtalk(1,Math)
double SUMFTmy(double A, double B)
{
return SUMFT(A,B);
}
and test.h:
#pragma dll("C:\Users\Alexey\Documents\OriginLab\2015\User Files\OriginC\test\test.dll")
// Prototype of the function in the external DLL
double __stdcall SUMFT(double A, double B);
When I build all that in Code Builder, I get error:
C:\Users\Alexey\Documents\OriginLab\2015\User Files\OriginC\test\test.c(41) :
Error, external DLL cannot find function C:\Users\Alexey\Documents\OriginLab\2015\User Files\OriginC\test\test.dll : SUMFT
What am I doing wrong? How to fix?