Closed CarvFS closed 1 year ago
Thank you for reporting this. I've committed changes to the develop branch which will create a generic interface block for class methods. This was an oversight on my part. I was thinking that only the type-bound procedures would need the generic clause.
Some splicer blocks with the name additional_interfaces are available to manually add any additional interfaces needed. The spicer is added at the global level as well as each namespace and class scope.
Thank you very much for your reply! I will take a look on the modifications you have made :)
About the _additionalinterface block:
In my .F90 wrapper I have it placed as below
type Class
[class procedures]
end type Class
interface operator (.eq.)
module procedure rism3d_eq
end interface
interface operator (.ne.)
module procedure rism3d_ne
end interface
Interface
[previous functions/subroutines]
! splicer begin namespace.tutorial.additional_interfaces
! splicer end namespace.tutorial.additional_interfaces
end interface
interface class_constructor
module procedure Class_ctor_0
module procedure Class_ctor_1
module procedure Class_ctor_2
end interface class_constructor
contains
I do not know if I got it correctly, but I was expecting this splicer block after the end interface
line.
I replaced the additional_interfaces splicer with an additional_declarations splicer which is at the top level, outside of any other interface block. This will allow other interface
blocks, generic interface, or any other declarations to be added.
interface class1
module procedure class1_new
end interface class1
! splicer begin namespace.tutorial.additional_declarations
! splicer end namespace.tutorial.additional_declarations
contains
This change is now in the develop branch.
Thank you very much!!!
Hello!
I have noticed one thing while defining member functions of a class containing default arguments.
If the Shroud script is just for the function, e.g.:
The Fortran wraper will have an interface wraper defined as:
Thus, one may use the function as, for example,
value = method2(arg1,optional_args)
.However, if the functions is defined as class member, e.g.:
The Fortran wrapper contains only the interface for the constructor:
And the functions are defined as procedures inside the defined type:
Thus one may use the functions in the main Fortran program as type-bound functions:
In this case,
method1
can also be used asclass1_method1(cptr, 1)
. However this is not possible formethod2
. I have managed to solve this by manually adding the interface formethod2
:However, if one needs to run shroud again it will be needed to keep inserting the interface into the fortran wrapper. It seems there is no splicer to keep this additions in the
splicer.f
file.Is there some shroud input I am missing for this case?
Thank you very much! Felipe Silva Carvalho