From 001e7c692c2cf0927e5fbd111748453335b651af Mon Sep 17 00:00:00 2001 From: baol Date: Mon, 13 May 2024 16:31:48 +0800 Subject: [PATCH] change readme.md --- READMe.md => README.md | 11 +++++++++++ 1 file changed, 11 insertions(+) rename READMe.md => README.md (88%) diff --git a/READMe.md b/README.md similarity index 88% rename from READMe.md rename to README.md index 6545ac8..093c304 100644 --- a/READMe.md +++ b/README.md @@ -4,3 +4,14 @@ * a FORTRAN90 subroutine or function expects all its arguments to be passed by reference. This generally means simply that the C++ function must pass scalar variables by reference, not value. * typically, when the FORTRAN90 compiler compiles the FORTRAN90 code, the names of functions and subroutines are stored with an appended underscore. In order for these names to be found by the C++ code, it is necessary that the C++ code declare and invoke the FORTRAN90 functions and subroutines with the underscore explicitly appended to the name. * in many cases, a FORTRAN90 compiler is simply a "front end" to a corresponding C++ compiler, as in the case of the GNU compilers gfortran and g++, or the Intel compilers ifort and icpp. This means that, as long as the corresponding compilers are used to compile the FORTRAN90 and C++ codes, it is probably possible to use either compiler to link and load the object codes; however, the load command may need to specify explicitly certain libraries associated with one of the languages. For instance, if loading using the gcc command, it is necessary to include "-l gfortran" so that the FORTRAN90 I/O libraries, among others, are included in the build. + + +## use bind(C) in F90 + +``` shell + +gfortran -shared -o math_module.so math_module.f90 +g++ hello.cpp -L. -lmath_module -o main +g++ hello.cpp /path/to/math_module.so -o main + +```