1#include <rest_call.h>
2#include <stdio.h>
3#include <string.h>
4
5void sum(
7 int32_t argc,
10{
11 (void)ctx;
12 (void)argc;
13
14 int32_t *a = argv[0].
ptr;
15 int32_t *b = argv[1].
ptr;
16
17 *(int32_t*)result->
ptr = *a + *b;
18}
19
20int main(int argc, char *argv[]) {
22
23 ecs_function(world, {
24 .name = "sum",
26 .params = {
29 },
30 .callback = sum
31 });
32
33 printf("Try: curl 'http://localhost:27750/call/sum?a=10&b=20'\n");
34
36 .enable_rest = true
37 });
38}
FLECS_API int ecs_app_run(ecs_world_t *world, ecs_app_desc_t *desc)
Run application.
FLECS_API const ecs_entity_t ecs_id(EcsDocDescription)
Component ID for EcsDocDescription.
struct ecs_world_t ecs_world_t
A world is the container for all ECS data and supporting features.
ecs_world_t * ecs_init_w_args(int argc, char *argv[])
Create a new world with arguments.
void * ptr
Pointer to value.