/* This file is part of Lcrzo.
*/

lcrzo_bool lcrzo_priv_lcrzowasinitialized=LCRZO_FALSE;
int lcrzo_init(void)
{
  /* ignore double initialization */
  if (lcrzo_priv_lcrzowasinitialized)
  { return(LCRZO_ERR_OK);
  }
  lcrzo_priv_lcrzowasinitialized=LCRZO_TRUE;

#if LCRZO_PRIV_DATA_ALLOC_DEBUG==2
  lcrzo_er(checkmemory_init());
#endif

#if defined LCRZODEF_SYSTEM_Unix
#elif defined LCRZODEF_SYSTEM_Windows
  lcrzo_er(lcrzo_priv_init_tlsalloc());
  lcrzo_er(lcrzo_priv_criticalsection_init());
#else
 #error "Unknown value for LCRZODEF_SYSTEM"
#endif

  lcrzo_er(lcrzo_priv_globalvars_init());

#if defined LCRZODEF_SYSTEM_Unix
  lcrzo_er(lcrzo_priv_childprocesses_init());
#elif defined LCRZODEF_SYSTEM_Windows
  lcrzo_er(lcrzo_priv_winsock_init());
#else
 #error "Unknown value for LCRZODEF_SYSTEM"
#endif

  return(LCRZO_ERR_OK);
}

