Hello, i don't know what is happening right now... because i'm doing a dll function that should be doing a task in another thread.
My actual attempt is to make it work after compile, because yes, it compiles... but it throws me an error "LoadLibraryA failed with error code 126" and this only happens when i put a line like : "pthread_create" or "pthread_detach", and it's weird, because in a console application it does work, but when trying to implement this on a dll... nothing happens, and also makes the dll unusable.
Well, i will bring a clearly reproducible example, like:
Console application (Works):
well, now the thing i tryed with the dll (Giving me troubles and i don't know why):
So yes, it returns 0 instead of 102, because of the loadlibrary error... So, i don't know what to proceed in this case.
My actual attempt is to make it work after compile, because yes, it compiles... but it throws me an error "LoadLibraryA failed with error code 126" and this only happens when i put a line like : "pthread_create" or "pthread_detach", and it's weird, because in a console application it does work, but when trying to implement this on a dll... nothing happens, and also makes the dll unusable.
Well, i will bring a clearly reproducible example, like:
Console application (Works):
C++:
#include <pthread.h>
#include <cstddef>
#include <iostream>
using namespace std;
void* process_mt(void* input){
int in = 4;
cout << "OTHER! \n" << endl;
pthread_exit((void*) in);
return nullptr;
}
int main()
{
pthread_t th;
pthread_create(&th, NULL, process_mt, NULL);
cout << "Hello world! \n" << endl;
return 0;
}
C++:
#include <pthread.h>
#include <cstddef>
#include <iostream>
#define GMEXPORT extern "C" __declspec(dllexport)
using namespace std;
void* process_mt(void* input){
int in = 4;
cout << "OTHER! \n" << endl;
pthread_exit((void*) in);
return nullptr;
}
//*/
GMEXPORT double multithread_test(void* Buffer){
pthread_t th;
pthread_create(&th, NULL, process_mt, NULL);//This don't work, and i don't know why
return 102;
}