Skip to content

Commit 886a63d

Browse files
committed
Implement initial wrapper
1 parent 6825bfb commit 886a63d

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

src/CMakeLists.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
set(SRC
2-
basic.f90
2+
wrapper.c
3+
basic.f90
34
)
45

56
include_directories(BEFORE ${python_wrapper_BINARY_DIR}/symengine/lib)

src/wrapper.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include <symengine/cwrapper.h>
2+
3+
void f(int i)
4+
{
5+
char *s;
6+
basic x, y, e, n;
7+
basic_new_stack(x);
8+
basic_new_stack(y);
9+
basic_new_stack(e);
10+
basic_new_stack(n);
11+
symbol_set(x, "x");
12+
symbol_set(y, "y");
13+
integer_set_si(n, i);
14+
basic_mul(e, n, x);
15+
basic_add(e, e, y);
16+
s = basic_str(e);
17+
printf("Result: %s", s);
18+
basic_str_free(s);
19+
}

0 commit comments

Comments
 (0)