Hi
I am working on VS2010 mixed-programing and use the Intel Compiler / VisualStudio (Intel Parallel 2015) to compile my project in VS 2010.
Console - c source:
#include <stdio.h> #include <stdlib.h> #include <conio.h> #include <string.h> //#define readfile readfile_ extern void readfile(char*, int*); int main() { int n, count; char Fname[9]; char Name[10]; strcpy(Fname,"AMIN.for"); fprintf( stderr, "%s\n", Fname); readfile( Fname, &n , strlen (Fname)); fprintf( stderr, "n = %d\n", n); // fprintf( stderr, "%s\n", Name); getch(); return 0; }
Subroutine - Lib fortran:
subroutine readfile( fname1, m ) character fname1*(*) integer m integer iounit,i iounit=15 write(*,*) fname1 c10 format (a9) open(iounit,file = fname1,action='read') read (iounit,*) m c20 format (i10) write(*,*) m close(iounit) return end subroutine
I change setting to "lower Case" (Lib1:properties->fortran->External Procedure) and my project return "n=10" and I don't have a problem, BUT in this line I have a question
readfile( Fname, &n, strlen(Fname) );
I want to change that line. I want compile without strlen like:
readfile( Fname, &n );
When i comiple my project,it can not open and return the contents of My file(AMIN.for).
I change setting for "Lib1" in property page->fortran->External Procedure :
" Calling conversion ----> (from "default" to "STDCALL") "
and I compile it again but it can not return the contents that I want(n=10).
I want to passed force from string lenght argumet with change setting or define a little function(any trick!).
how to do it?
excuse me for bad spelling