aaronryank / fork-bomb

Fork bombs in lots of languages
The Unlicense
750 stars 134 forks source link

add Fortran #26

Closed ghost closed 1 year ago

ghost commented 1 year ago

This is a commit to add support for the Fortran programming language.

There is just one problem... fork doesn't exist in Fortran.

Fortran does not require prototypes or anything fancy like C, in order to to successfully build this program you need to link it to an object file that defines a fork function. The easiest way to do that is to use C.

This is the main problem with Fortran, and the reason that I was hesitant to create this pull request; without support from another language this program doesn't work.

It's up to maintainers if they would like to add it as-is, add it in its own directory with a wrapper function that works with Fortran, or not at all. Just know that I did actually get this program to work, I just needed to write a simple wrapper function in a C file called fork_ (gfortran likes to append an underscore to function calls for some reason, this is why simply linking libc doesn't work).