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:
The GameMaker call:
DLL download link:
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
GML:
dll_area_of_circle = external_define("cspline.dll","area_of_circle",dll_cdecl,ty_real,1,ty_real)
cspline
MediaFire is a simple to use free service that lets you put all your photos, documents, music, and video in a single place so you can access them anywhere and share them everywhere.
www.mediafire.com