• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Extension fails when calling specific function

M

msrojas

Guest
I have a DLL that works fine until I call this function
Code:
void ca_cutscene_destroy()
{
    struct struct_script_persistent_index * current_pointer = NULL;
    struct struct_script_persistent_index * temp_pointer = NULL;

    if(main_struct)
    {
        current_pointer = main_struct->head;
        while(current_pointer != NULL)
        {
            temp_pointer = current_pointer;
            current_pointer = current_pointer->next;
            free(temp_pointer);
        }

        main_struct->size = 0.0f;
        main_struct->head = NULL;
        main_struct->tail = NULL;
        free(main_struct);
        main_struct = NULL;
        current_script_index = NULL;
    }
}
And here is the header file
Code:
#ifndef CA_CUTSCENE_PERSISTENT_SCRIPT_INDEX
#define CA_CUTSCENE_PERSISTENT_SCRIPT_INDEX

#if __cplusplus
extern "C" {
#endif

#if defined(__WIN32) || defined(__WIN64)
    #ifdef BUILDING_FILE
    #define CA_DLL __declspec(dllexport)
    #else
    #define CA_DLL __declspec(dllimport)
    #endif
#endif

struct struct_script_persistent_index
{
    double index;
    struct struct_script_persistent_index * next;
};

struct struct_handler_script_index
{
    double size;
    struct struct_script_persistent_index * head;
    struct struct_script_persistent_index * tail;
};

#if defined(__WIN32) || defined(__WIN64)
CA_DLL void ca_cutscene_destroy();
static void CA_free_pointer(struct struct_script_persistent_index * current_pointer, struct struct_script_persistent_index * last_pointer);
CA_DLL void ca_cutscene_free_index(double index);
CA_DLL void ca_go_back_to_head();
CA_DLL double ca_get_next_persistent_index();
CA_DLL double ca_cutscene_get_size();
static struct struct_script_persistent_index * CA_get_node(double index);
CA_DLL void ca_cutscene_add_persistent_index(double index);
CA_DLL void ca_init_cutscene_persistent_index();
#else
void ca_cutscene_destroy();
static void CA_free_pointer(struct struct_script_persistent_index * current_pointer, struct struct_script_persistent_index * last_pointer);
void ca_cutscene_free_index(double index);
void ca_go_back_to_head();
double ca_get_next_persistent_index();
double ca_cutscene_get_size();
static struct struct_script_persistent_index * CA_get_node(double index);
void ca_cutscene_add_persistent_index(double index);
void ca_init_cutscene_persistent_index();
#endif

#if __cplusplus
}
#endif

#endif
I do not know what is the problem. I have test the library outside Game Maker, and it works fine.
When Game maker tries to call the function it return this error
Code:
C:\ProgramData/GameMakerStudio2/Cache/runtimes\runtime-2.1.3.189/windows/Runner.exe exited with non-zero status (-1073741819)
The compiler I use is MinGW.
 
Top