curl / Mailing Lists / curl-library / Single Mail

curl-library

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

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

On Wed, 12 Apr 2017, curl.greatwolf_at_mamber.net 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.

-- 
  / daniel.haxx.se
-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette:   https://curl.haxx.se/mail/etiquette.html
Received on 2017-04-16