Rhino crashing C++

Hi, I am using a solver in C++ inside the ghPython component, it all works fine, however, Rhino is often crashing. Any advice on that?

Here is the function that I use inside gh component, calling the dll (64bit).

from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import os

try:
    import ctypes
    import compas
    from compas.xdarray import Array2D
    from compas.xdarray import Array1D
    
except ImportError:
    import sys
    if 'ironpython' not in sys.version.lower():
        raise

SO = 'C:\\Users\\Elizabeta\\Desktop\\compas-main\\compas-main\\src\\compas\\numerical\\fd\\_fd_cpp\\fd.so'
DLL = 'C:\\Users\\Elizabeta\\Desktop\\compas-main\\compas-main\\src\\compas\\numerical\\fd\\_fd_cpp\\fd.dll'

__all__ = [
    'fd_cpp',
]

def fd_cpp(vertices, edges, fixed, q, loads):
    try:
        lib = ctypes.cdll.LoadLibrary(SO)
        print (lib)
    except Exception:
        try:
            lib = ctypes.cdll.LoadLibrary(DLL)
            print (DLL)
        except Exception:
            print(SO)
            print(DLL)
            raise

    free = [i for i in range(len(vertices)) if i not in fixed]

    cvertices = Array2D(vertices, 'double')
    cedges    = Array2D(edges, 'int')
    cloads    = Array2D(loads, 'double')
    cq        = Array1D(q, 'double')
    cfixed    = Array1D(fixed, 'int')
    cfree     = Array1D(free, 'int')

    lib.fd.argtypes = [
        ctypes.c_int,
        ctypes.c_int,
        ctypes.c_int,
        cvertices.ctype,
        cedges.ctype,
        cloads.ctype,
        cq.ctype,
        cfixed.ctype,
        cfree.ctype
    ]

    lib.fd(
        ctypes.c_int(len(vertices)),
        ctypes.c_int(len(edges)),
        ctypes.c_int(len(fixed)),
        cvertices.cdata,
        cedges.cdata,
        cloads.cdata,
        cq.cdata,
        cfixed.cdata,
        cfree.cdata
    )

    return cvertices.pydata