def make_function_type(cfnptr):
    """
    Return a Numba type for the given ctypes function pointer.
    """
    if cfnptr.argtypes is None:
        raise TypeError("ctypes function %r doesn't define its argument types; "
                        "consider setting the `argtypes` attribute"
                        % (cfnptr.__name__,))
    cargs = [from_ctypes(a)
             for a in cfnptr.argtypes]
    cret = from_ctypes(cfnptr.restype)
    # void* return type is a int/long on 32 bit platforms and an int on 64 bit
    # platforms, explicit conversion to a int64 should match.
    if cret == types.voidptr:
        cret = types.uintp
    if sys.platform == 'win32' and not cfnptr._flags_ & ctypes._FUNCFLAG_CDECL:
        # 'stdcall' calling convention under Windows
        cconv = 'x86_stdcallcc'
    else:
        # Default C calling convention
        cconv = None

    sig = templates.signature(cret, *cargs)
    return types.ExternalFunctionPointer(sig, cconv=cconv,
                                         get_pointer=get_pointer)

    Return a Numba type for the given ctypes function pointer.
    
numba/core/typing/ctypes_utils.py