- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
## types.h ## struct Node; typedef union { char *value; Node *next; } child_t; struct Node { int type; int *key; child_t *child; Node() { key = new int[FAN_OUT]; child = new child_t[FAN_OUT]; } };
## Enclave.edl ## include "types.h" trusted { public void ecall_printf_node([in] struct Node *root); };
I want to pass a node of B+ Tree to the enclave from an outsider app. However, it reports the following error:
GEN => App/Enclave_u.c
In file included from App/Enclave_u.h:10:0,
from App/Enclave_u.c:1:
Include/types.hpp:23:9: error: unknown type name ‘Node’
Node *next;
^~~~
Include/types.hpp:33:9: error: expected specifier-qualifier-list before ‘Node’
Node()
^~~~
Makefile:178: recipe for target 'App/Enclave_u.o' failed.
Three questions:
1) In the enclave, does it supports a forward declaration of a class or struct? such as "struct Node" as above;
2) In the enclave, should the struct have a constructor? such as the function "Node()" as above;
3) if not, how should I achieve above?
- Tags:
- General Support
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Xiaoguo,
The problem is that constructors in structs are allowed in C++ but are now allowed in C. The Edger8r tool will create bridge functions for your ecalls and ocalls in C, as you see in Enclave_u.c. You can call C++ class methods in your enclave but the enclave interface functions, i.e. e-calls, must be written in C. See the SGX Developer Reference Guide table 7 or 8, titled Summary of Intel SGX Rules and Limitations for more information.
A similar question has been addressed here.
Regards,
Jesus
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello Xiaoguo,
The problem is that constructors in structs are allowed in C++ but are now allowed in C. The Edger8r tool will create bridge functions for your ecalls and ocalls in C, as you see in Enclave_u.c. You can call C++ class methods in your enclave but the enclave interface functions, i.e. e-calls, must be written in C. See the SGX Developer Reference Guide table 7 or 8, titled Summary of Intel SGX Rules and Limitations for more information.
A similar question has been addressed here.
Regards,
Jesus

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page