diff --git a/automated_fortran_cpp_binding_for_large_scale_scientific_applications.pdf b/automated_fortran_cpp_binding_for_large_scale_scientific_applications.pdf new file mode 100644 index 0000000..2822b11 --- /dev/null +++ b/automated_fortran_cpp_binding_for_large_scale_scientific_applications.pdf @@ -0,0 +1,16 @@ +--2024-05-13 16:25:52-- https://www.osti.gov/servlets/purl/1649607 +Resolving www.osti.gov (www.osti.gov)... 192.107.175.222 +Connecting to www.osti.gov (www.osti.gov)|192.107.175.222|:443... connected. +HTTP request sent, awaiting response... 302 +Location: https://www.osti.gov/biblio/1649607 [following] +--2024-05-13 16:25:53-- https://www.osti.gov/biblio/1649607 +Reusing existing connection to www.osti.gov:443. +HTTP request sent, awaiting response... 200 +Length: unspecified [text/html] +Saving to: ‘1649607’ + + 0K .......... .......... .......... .......... .......... 93.0K + 50K .......... .......... .......... ... 131K=0.8s + +2024-05-13 16:25:54 (105 KB/s) - ‘1649607’ saved [86013] + diff --git a/example0/hello b/example0/hello new file mode 100755 index 0000000..a282238 Binary files /dev/null and b/example0/hello differ diff --git a/example0/hello.cpp b/example0/hello.cpp new file mode 100644 index 0000000..4e8a062 --- /dev/null +++ b/example0/hello.cpp @@ -0,0 +1,14 @@ +#include + +extern "C" { + void add_number(float x, float y, float* sum); +} + +int main() { + float a = 5.0; + float b = 10.0; + float result; + add_number(a, b, &result); + std::cout << "the sum of the numbers is " << result << std::endl; + return 0; +} diff --git a/example0/hello.f90 b/example0/hello.f90 new file mode 100644 index 0000000..3401e81 --- /dev/null +++ b/example0/hello.f90 @@ -0,0 +1,13 @@ +program main + use math_module + implicit none + real :: a, b, result + + a = 5.0 + b = 10.0 + + call add_number(a, b, result) + + print *, "the sum of the number is : ", result + +end program main diff --git a/example0/hello.o b/example0/hello.o new file mode 100644 index 0000000..60bccda Binary files /dev/null and b/example0/hello.o differ diff --git a/example0/main b/example0/main new file mode 100755 index 0000000..a6adbf8 Binary files /dev/null and b/example0/main differ diff --git a/example0/math_module.f90 b/example0/math_module.f90 new file mode 100644 index 0000000..ba8889a --- /dev/null +++ b/example0/math_module.f90 @@ -0,0 +1,14 @@ +module math_module + use, intrinsic :: iso_c_binding + implicit none + +contains + + subroutine add_number(x, y, sum) bind(C, name="add_number") + implicit none + real(c_float), intent(in), value :: x, y + real(c_float), intent(out) :: sum + sum = x + y + end subroutine add_number + +end module math_module diff --git a/example0/math_module.mod b/example0/math_module.mod new file mode 100644 index 0000000..6f8dd11 Binary files /dev/null and b/example0/math_module.mod differ diff --git a/example0/math_module.o b/example0/math_module.o new file mode 100644 index 0000000..37ecfdb Binary files /dev/null and b/example0/math_module.o differ diff --git a/example0/math_module.so b/example0/math_module.so new file mode 100755 index 0000000..c35e015 Binary files /dev/null and b/example0/math_module.so differ