I am trying to build Calculix (for example here: https://github.com/prool/ccx_prool/tree/master/CalculiX/ccx_2.15/src) in Visual Studio 2015 with Intel Fortran. Normally it is built with gcc and gfortran. It mixes C and Fortran, and I am having troubles now with arrays dynamically allocated in C because in Fortran ifort expects a dimension.
subroutine calinput(kon) implicit none integer(C_LONG_LONG) kon(*)
But this is working:
subroutine calinput_c(kon, kons) bind(C) USE, INTRINSIC :: ISO_C_BINDING ! implicit none ! integer(C_LONG_LONG) kons integer(C_LONG_LONG), DIMENSION(kons) ::kon kon(1) = kon(1) return end
Is there a way to get the first variant to compile with ifort?
There was some work done previously to compile calculix, can I get the files?
Thank you in advance!
You don't say what isn't working in the first case. I am going to assume that your original code included "USE, INTRINSIC :: ISO_C_BINDING" as otherwise C_LONG_LONG would not be declared.
I will guess that one problem is that the C code assumes that the Fortran routine is named "callinput" in lowercase. Intel Fortran on Windows uses upper case for routine names, but gfortran does not. The addition of BIND(C) causes Intel Fortran to use lower case.
If neither of these are the problem, please provide more details, as the use of an assumed size array should work. The second code of course is also fine.
Hi Rechard, i am also working to compile CCX using Visual Studio and ifort, if you don't mind, may i ask whether you could share the VS projects with me? my email: email@example.com