Created
September 28, 2014 14:55
-
-
Save tsloughter/5c85ff9ecfe4e80a60ec to your computer and use it in GitHub Desktop.
Hello World Nif
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "erl_nif.h" | |
static ERL_NIF_TERM world(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[]) | |
{ | |
return enif_make_string(env, "Hello world!", ERL_NIF_LATIN1); | |
} | |
static ErlNifFunc nif_funcs[] = { | |
{"world", 0, world} | |
}; | |
ErlNifEntry* nif_init(void); | |
ErlNifEntry* nif_init(void) { | |
static ErlNifEntry entry = { 2, | |
6, | |
"hello", | |
sizeof(nif_funcs) / sizeof(*nif_funcs), | |
nif_funcs, | |
((void *)0), | |
((void *)0), | |
((void *)0), | |
((void *)0), | |
"beam.vanilla" | |
}; | |
return &entry; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment