-
Notifications
You must be signed in to change notification settings - Fork 0
/
example5.c
83 lines (62 loc) · 1.54 KB
/
example5.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include <stdio.h>
#include <stdlib.h>
#define LIBRARY_EXPORT __attribute__ ((visibility ("default")))
#ifdef __cplusplus
extern "C" {
#endif
// Integers
// Strings
// Arrays
// Structs
int LIBRARY_EXPORT incrementIntegerValueReturnValue(int input) {
int output;
output = 0;
output = input + 1;
return output;
}
int LIBRARY_EXPORT incrementIntegerPointerReturnValue(int * input) {
int output;
output = 0;
output = *input + 1;
return output;
}
void LIBRARY_EXPORT incrementIntegerPointerInInput(int * input) {
*input = *input + 1;
return;
}
void LIBRARY_EXPORT incrementIntegersInIntStarArray(int * input, int length) {
for (int i=0; i < length; i++) {
*(input + i) = *(input + i) + 1;
}
return;
}
void LIBRARY_EXPORT incrementIntegersInIntStarStarArray(int ** input, int length) {
for (int i=0; i < length; i++) {
*(*input + i) = *(*input + i) + 1;
}
return;
}
struct Structure {
int integer;
};
struct Structure LIBRARY_EXPORT incrementIntegerInStruct(struct Structure s) {
s.integer = s.integer + 1;
return s;
}
void LIBRARY_EXPORT incrementIntegerInStructPointer(struct Structure * s) {
s->integer = s->integer + 1;
return;
}
struct Structure LIBRARY_EXPORT initializeStructureStack() {
struct Structure s;
s = (struct Structure) { 10 };
return s;
}
struct Structure * LIBRARY_EXPORT initializeStructureHeap() {
struct Structure * s = malloc(sizeof(struct Structure));
s->integer = 13;
return s;
}
#ifdef __cplusplus
}
#endif