Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
New Contributor I
1 View

DLLEXPORT for derived type constructor

Suppose we have a derived type

module this_mod

    type :: this_type
        integer :: foo
    contains
        procedure :: bar
    end type this_type

    interface this_type
        module procedure :: constructThis
    end interface this_type

contains

    function constructThis() result(This)
        !DEC$ ATTRIBUTES DLLEXPORT :: constructThis
        type(this_type) :: This
    end function constructThis

end module this_mod

Is this a proper way to export the constructor of this_type? or should the exported name be the same as the derived type's name this_type?

0 Kudos
2 Replies
Highlighted
Valued Contributor III
1 View

Quote:A. King wrote:

A. King wrote:

.. or should the exported name be the same as the derived type's name this_type?

You should be able to use ALIASing facility with !DIR$ ATTRIBUTES to export the name of your choice, otherwise it must be the name of the procedure plus you may need decorations depending on the calling conventions in effect (e.g., STDCALL).

0 Kudos
Highlighted
Black Belt
1 View

The way you did it is correct

The way you did it is correct. 

Steve (aka "Doctor Fortran") - https://stevelionel.com/drfortran
0 Kudos