2

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.

Youseflapod
  • 132
  • 1
  • 10

1 Answers1

6

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.

Matteo Italia
  • 123,740
  • 17
  • 206
  • 299
  • So I need to put the dll in the folder that .exe compiles in? And the alternative is to build libcurl as a static library. Does that mean in my deployment applications there has to be a few dll files in the folder of the .exe? I thought those went in sys32. Is that the global search space? – Youseflapod Nov 18 '19 at 14:24
  • 1. Yes. 2. Yes. 3. Yes. 4. It's possible to install dlls globally, but in general you don't want to pollute the system with your private dependencies (and conversely, you don't want other programs to step on them with their versions). 5. Mostly yes, but it's more complicated than that; see https://learn.microsoft.com/it-it/windows/win32/dlls/dynamic-link-library-search-order. – Matteo Italia Nov 18 '19 at 20:04