4
* Copyright Ericsson AB 2009. All Rights Reserved.
4
* Copyright Ericsson AB 2009-2010. All Rights Reserved.
6
6
* The contents of this file are subject to the Erlang Public License,
7
7
* Version 1.1, (the "License"); you may not use this file except in
8
8
* compliance with the License. You should have received a copy of the
9
9
* Erlang Public License along with this software. If not, it can be
10
10
* retrieved online at http://www.erlang.org/.
12
12
* Software distributed under the License is distributed on an "AS IS"
13
13
* basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
14
* the License for the specific language governing rights and limitations
15
15
* under the License.
20
20
/* Include file for writers of Native Implemented Functions.
23
#define ERL_NIF_MAJOR_VERSION 0
24
#define ERL_NIF_MINOR_VERSION 1
26
#include "erl_drv_nif.h"
32
#define ERL_NIF_MAJOR_VERSION 1
33
#define ERL_NIF_MINOR_VERSION 0
26
35
#include <stdlib.h>
28
37
typedef unsigned long ERL_NIF_TERM;
39
struct enif_environment_t;
40
typedef struct enif_environment_t ErlNifEnv;
34
void* fptr; //ERL_NIF_TERM (*fptr)(void*, ...);
46
ERL_NIF_TERM (*fptr)(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]);
37
struct enif_environment_t;
38
typedef struct enif_environment_t ErlNifEnv;
40
49
typedef struct enif_entry_t
60
69
/* Internals (avert your eyes) */
61
70
ERL_NIF_TERM bin_term;
62
unsigned char* tmp_alloc;
74
typedef struct enif_resource_type_t ErlNifResourceType;
75
typedef void ErlNifResourceDtor(ErlNifEnv*, void*);
76
enum ErlNifResourceFlags
78
ERL_NIF_RT_CREATE = 1,
79
ERL_NIF_RT_TAKEOVER = 2
87
typedef ErlDrvSysInfo ErlNifSysInfo;
89
typedef struct ErlDrvTid_ *ErlNifTid;
90
typedef struct ErlDrvMutex_ ErlNifMutex;
91
typedef struct ErlDrvCond_ ErlNifCond;
92
typedef struct ErlDrvRWLock_ ErlNifRWLock;
93
typedef int ErlNifTSDKey;
95
typedef ErlDrvThreadOpts ErlNifThreadOpts;
67
97
#if (defined(__WIN32__) || defined(_WIN32) || defined(_WIN32_))
68
98
# define ERL_NIF_API_FUNC_DECL(RET_TYPE, NAME, ARGS) RET_TYPE (*NAME) ARGS