summaryrefslogtreecommitdiff
path: root/src/env/env_init.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/env/env_init.c')
-rw-r--r--src/env/env_init.c41
1 files changed, 41 insertions, 0 deletions
diff --git a/src/env/env_init.c b/src/env/env_init.c
new file mode 100644
index 00000000000..26c7062d63f
--- /dev/null
+++ b/src/env/env_init.c
@@ -0,0 +1,41 @@
+/*-
+ * See the file LICENSE for redistribution information.
+ *
+ * Copyright (c) 2008-2011 WiredTiger, Inc.
+ * All rights reserved.
+ *
+ * $Id$
+ */
+
+#include "wt_internal.h"
+
+/*
+ * wiredtiger_env_init --
+ * Initialize the library, creating an ENV handle.
+ */
+int
+wiredtiger_env_init(ENV **envp, uint32_t flags)
+{
+ static int library_init = 0;
+ ENV *env;
+
+ *envp = NULL;
+
+ /*
+ * We end up here before we do any real work. Check the build itself,
+ * and do some global stuff.
+ */
+ if (library_init == 0) {
+ WT_RET(__wt_library_init());
+ library_init = 1;
+ }
+
+ WT_ENV_FCHK(NULL,
+ "wiredtiger_env_init", flags, WT_APIMASK_WIREDTIGER_ENV_INIT);
+
+ /* Create the ENV handle. */
+ WT_RET(__wt_env_create(flags, &env));
+
+ *envp = env;
+ return (0);
+}