I'm upgrading an application to allow for dynamically-loaded DLLs created by the user. (I'm basing it on the DynamicLoad Intel example). For my case, one of the arguments to the main subroutine that will be required in the DLL is a derived type. A dumbed-down example is below:
type :: mytype integer :: i = 0 character(len=:),allocatable :: name type(mytype),pointer :: next => null() end type mytype
Note that it contains an allocatable character string, which is not interoperable with C, based on my understanding. It also contains pointers that are used to construct a linked list. The mytype dummy argument for the DLL routine is also a pointer. My questions are:
1. Is it OK to have DLLs on Windows with derived types arguments that contain variables that aren't C-interoperable?
2. Should I include a SEQUENCE statement in this type? It seems to work with or without it.
3. I presume the DLL can only be written in Fortran, unless I were to refactor the type to use interoperable character arrays and c_ptr's? As it is now, would it work with any Fortran compiler, or would it have to be Intel?
4. Is it enough to publish the mytype declaration, and have the user declare it themselves within their DLL? Is that a problem that the type is defined twice (once in my main program and once in their DLL)? Does SEQUENCE make this OK? Or, would BIND(C) make this OK?
Any help would be appreciated! Thanks in advance!