Returns the ctypes argtypes for use with the method.argtypes assignment for
        an executable loaded from a shared library.

def argtypes(self):
        """Returns the ctypes argtypes for use with the method.argtypes assignment for
        an executable loaded from a shared library.
        """
        if self.dimension is not None:
            result = []
            if "in" in self.direction:
                #The only complication here is that the 'known' dimensionality could actually
                #be a function like "size" that needs information about other variables.
                #If we choose to ignore known shapes, we lose the error checking for the passed
                #in variables from the python side.
                if self.direction == "(inout)" and ":" not in self.dimension:
                    wstr = ", writeable"
                else:
                    wstr = ""

                if ":" in self.dimension or "size" in self.dimension:
                    template = 'ndpointer(dtype={}, ndim={}, flags="F{}")'
                    result.append(template.format(self.pytype, self.D, wstr))
                else:
                    template = 'ndpointer(dtype={}, ndim={}, shape=({}), flags="F{}")'
                    sdim = self.dimension + ("" if self.D > 1 else ",")
                    result.append(template.format(self.pytype, self.D, sdim, wstr))
            elif self.direction == "(out)":
                result.append("c_void_p")

            if self.D > 0 and ":" in self.dimension:
                result.extend(["c_int_p" for i in range(self.D)])
            if (self.direction == "(inout)" and ":" in self.dimension and
                ("allocatable" in self.modifiers or "pointer" in self.modifiers)):
                result.append("c_void_p")
            return result
        else:
            ctype = self.ctype
            if ctype is not None:
                return ["{}_p".format(ctype.lower())]