Skip to content
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/test_language_bindings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ jobs:
needs:
- test_Cpp
- test_csharp
- test_fortran
- test_go
- test_haskell
- test_java
Expand Down Expand Up @@ -66,6 +67,18 @@ jobs:
run: |
make cs

test_fortran:
name: "Test: FORTRAN"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: fortran install
run: sudo apt-get install gfortran
- name: make go
Comment thread
ianfhunter marked this conversation as resolved.
Outdated
run: make fortran


test_go:
name: "Test: GoLang"
Expand Down
18 changes: 18 additions & 0 deletions src/FORTRAN/gnoll.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
program main
interface
function roll_and_write(s, f) bind(c, name="roll_and_write")
import :: C_CHAR
character(kind=C_CHAR), dimension(*), intent(in) :: s, f
integer :: roll_and_write
end function roll_and_write
end interface

character(len=100) :: s, f
integer :: result

s = "d20"
f = "output.die"

result = roll_and_write(s, f)
print *, "Result:", result
end program main
7 changes: 7 additions & 0 deletions src/FORTRAN/target.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@

.PHONY: fortran
fortran: all
cp build/dice.so build/libdice.so
cd src/FORTRAN && ln -s ../../build c_build
cd src/FORTRAN && ln -s ../../src/grammar c_includes
cd src/FORTRAN && LD_LIBRARY_PATH="${PWD}/build:${LD_LIBRARY_PATH}" gfortran -o main gnoll.f90 -lroll_and_write && ls output.die