Only used for writing Python extension modules. Datastructure to hold information about your Python extension module. Put exactly one instance at Fortran module level.
Python 3: initialise and configure in PyInit_
Python 2: initialise in init
Initialises the PythonModule with a PythonMethod table.
Python 3: the return value must be returned by PyInit_module name
Python 2: call in initmodule name, ignore return value
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(PythonModule), | intent(inout) | :: | self | |||
character(kind=C_CHAR,len=*), | intent(in) | :: | module_name | Name of the Python extension module. |
||
character(kind=C_CHAR,len=*), | intent(in) | :: | doc_string | Doc string for the Python extension module. |
||
type(PythonMethodTable), | intent(in) | :: | method_table | Table of methods of the Python extension module. |
Adds a Python object to the module that can be accessed by my_module.the_name_of_object_added Useful to add constants to a Python module
add an object as a member to a module
Type | Intent | Optional | Attributes | Name | ||
---|---|---|---|---|---|---|
class(PythonModule), | intent(inout) | :: | self | |||
character(kind=C_CHAR,len=*), | intent(in) | :: | object_name | Name of the module member. It can be accessed by module_name.object_name in Python. |
||
class(object), | intent(in) | :: | obj | The object to add as a member to the module. |
Error code, 0 on success.