• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Attempting to use Fortran dll with GMS1, having issues

P

PhenomenalDev

Guest
I have produced a dll with gfortran that performs a basic function (shown below) and have attempted to write code to interface with it but I get the classic 'error defining external function' when I attempt to define a function from it and I'm not sure why. I know the function is exposed as I've used a dll viewer to prove it is and I have tried to write all the usual necessary interfaces that allow C++ interop with Fortran so I'm left at a bit of a puzzle as to where the issue lies. The code for all my stuff is below and I've linked the compiled dll below.

The dll source:
Code:
module main

    use, intrinsic :: iso_c_binding

    implicit none

contains

    function area_of_circle(r) bind(c, name="area_of_circle")


        ! function result

        implicit none


        !DEC$ ATTRIBUTES DLLEXPORT :: area_of_circle


        double precision :: area_of_circle


        ! dummy arguments

        double precision :: area


        ! local variables

        double precision, intent(in) :: r

        double precision :: pi


        pi = 4 * atan (1.0)

        area = pi * r**2


        area_of_circle = area


        return

    end function area_of_circle


end module
The GameMaker call:
GML:
dll_area_of_circle = external_define("cspline.dll","area_of_circle",dll_cdecl,ty_real,1,ty_real)
DLL download link:
 
Top