Reputation: 75
I'm trying to run some basic libCurl code in C, but I notice that for all my attempts, my programs crash at initialization (curl_global_init() or curl_easy_init()). Even with this tiny little test, the crash program. And none of my 2 printf() - before or after - are displayed.
I get an error code: "Process finished with exit code -1073741515 (0xC0000135)"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h>
int main() {
CURL *tcurl;
printf("Before crash\n");
tcurl = curl_easy_init(); // exactly crashes in this statement.
printf("After crash\n");
curl_easy_cleanup(tcurl);
curl_global_cleanup();
return 0;
}
Does anyone have any ideas to help me?
I'm on Windows 10, I use Cmake to compile.
Thank you very much!
Upvotes: 0
Views: 2044
Reputation: 91
I had similar issue today. Below is the GDB stack trace
#1 0x0000555555d99d5d in CRYPTO_STATIC_MUTEX_lock_write ()
#2 0x0000555555d22d4a in CRYPTO_get_ex_new_index ()
#3 0x00005555557b37f3 in ossl_init ()
#4 0x000055555578054b in global_init ()
#5 0x00005555557808e9 in curl_easy_init ()
This was because the custom compiled SSL and ZLIB libraries by another library (other than curl library) that was linked with my program.
I removed that library and it started working fine.
Just posting it here, so that it may help you.
However this is was in linux. Similarly on windows there might be some SSL or CRYPTO package that is creating the issue for you. Just check if curl libraries you have downloaded are based on WinSSL or OpenSSL. That might give some idea.
Upvotes: 1