Youseflapod
Youseflapod

Reputation: 142

Why does using curl_easy_init() output unusual error code?

I am currently learning C, using CLion on Windows, and as so I am starting off with a very simple program using cURL.

I have finally successfully included the library in my code using CMake as performed in this question: How do I link dynamically built cmake files on Windows?

The code now builds without error.

The issue is, as soon as I write the curl_easy_init(), the program outputs with an unusual exit code not referenced in the cURL docs and print functions fail to output like normal.

#include <stdio.h>
#include <curl/curl.h>

int main(void) {
    printf("Hello world!\n");

    CURL *curl;
    CURLcode res;

    curl = curl_easy_init(); // Line that changes program 

    return 0;
}

Whenever that dreadful line is written, the program no longer outputs a happy old "Hello World!" with an exit code of zero, and instead, outputs this:

Process finished with exit code -1073741515 (0xC0000135)

What even is that exit code??

Any information is much appreciated.

Upvotes: 2

Views: 560

Answers (1)

Matteo Italia
Matteo Italia

Reputation: 126947

0xC0000135 is "application not correctly initialized", which generally indicates that the loader cannot find a dll required by your application. Most probably you linked the libcurl import library, but the corresponding dll (libcurl.dll) cannot be found in the same directory of the executable and isn't in the global dll search paths. Make sure the dll is available when you launch your application, or link libcurl statically.

Upvotes: 6

Related Questions