curl / Mailing Lists / curl-library / Single Mail


Re: Is it safe to call `curl_global_init` before main()?

From: Daniel Stenberg <>
Date: Sun, 16 Apr 2017 11:42:52 +0200 (CEST)

On Wed, 12 Apr 2017, wrote:

> Is it okay to call `curl_global_init` and `curl_global_cleanup` before and
> after main() respectively?

Yes it probably is. libcurl has no relation to main() so it doesn't care if it
gets called before or after that entry point. As long as the heap is ready to
get used etc.

The main thing the curl_global_init function does is setting up third party
libraries so they are really the ones that need to work in this situation.

Received on 2017-04-16