<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Hello Xiaoguo, in Intel® Software Guard Extensions (Intel® SGX)</title>
    <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/HELP-Maybe-something-wrong-in-defining-struct-in-Enclave/m-p/1170370#M3180</link>
    <description>&lt;P&gt;Hello Xiaoguo,&lt;/P&gt;&lt;P&gt;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.&amp;nbsp; You can call C++ class methods in your enclave but the enclave interface functions, i.e. e-calls,&amp;nbsp;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.&lt;/P&gt;&lt;P&gt;A similar question has been addressed &lt;A href="https://software.intel.com/en-us/forums/intel-software-guard-extensions-intel-sgx/topic/639631"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jesus&lt;/P&gt;</description>
    <pubDate>Fri, 24 Apr 2020 18:23:09 GMT</pubDate>
    <dc:creator>JesusG_Intel</dc:creator>
    <dc:date>2020-04-24T18:23:09Z</dc:date>
    <item>
      <title>HELP! Maybe something wrong in defining struct in Enclave.</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/HELP-Maybe-something-wrong-in-defining-struct-in-Enclave/m-p/1170369#M3179</link>
      <description>&lt;PRE class="brush:cpp; class-name:dark;"&gt;##  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];
        }
};&lt;/PRE&gt;

&lt;PRE class="brush:cpp; class-name:dark;"&gt;##   Enclave.edl  ##

include "types.h"

trusted {
        public void ecall_printf_node([in] struct Node *root);
};&lt;/PRE&gt;

&lt;P&gt;I want to pass a node of&amp;nbsp;B+ Tree to the enclave from an outsider app. However, it reports the following error:&lt;/P&gt;
&lt;P&gt;GEN &amp;nbsp;=&amp;gt; &amp;nbsp;App/Enclave_u.c&lt;BR /&gt;In file included from App/Enclave_u.h:10:0,&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;from App/Enclave_u.c:1:&lt;BR /&gt;Include/types.hpp:23:9: error: unknown type name ‘Node’&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Node *next;&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;^~~~&lt;BR /&gt;Include/types.hpp:33:9: error: expected specifier-qualifier-list before ‘Node’&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Node()&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;^~~~&lt;BR /&gt;Makefile:178: recipe for target 'App/Enclave_u.o' failed.&lt;/P&gt;
&lt;P&gt;Three questions:&lt;/P&gt;
&lt;P&gt;1) In the enclave, does it supports a&amp;nbsp;forward declaration of a class or struct? such as&amp;nbsp; &amp;nbsp;"struct Node"&amp;nbsp; &amp;nbsp;as above;&lt;/P&gt;
&lt;P&gt;2) In the enclave, should the struct have a constructor?&amp;nbsp;&amp;nbsp; such as&amp;nbsp; the function&amp;nbsp; "Node()"&amp;nbsp; &amp;nbsp;as above;&lt;/P&gt;
&lt;P&gt;3) if not, how should I achieve above?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2020 02:55:23 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/HELP-Maybe-something-wrong-in-defining-struct-in-Enclave/m-p/1170369#M3179</guid>
      <dc:creator>Li__Xiaoguo</dc:creator>
      <dc:date>2020-04-24T02:55:23Z</dc:date>
    </item>
    <item>
      <title>Hello Xiaoguo,</title>
      <link>https://community.intel.com/t5/Intel-Software-Guard-Extensions/HELP-Maybe-something-wrong-in-defining-struct-in-Enclave/m-p/1170370#M3180</link>
      <description>&lt;P&gt;Hello Xiaoguo,&lt;/P&gt;&lt;P&gt;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.&amp;nbsp; You can call C++ class methods in your enclave but the enclave interface functions, i.e. e-calls,&amp;nbsp;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.&lt;/P&gt;&lt;P&gt;A similar question has been addressed &lt;A href="https://software.intel.com/en-us/forums/intel-software-guard-extensions-intel-sgx/topic/639631"&gt;here&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Jesus&lt;/P&gt;</description>
      <pubDate>Fri, 24 Apr 2020 18:23:09 GMT</pubDate>
      <guid>https://community.intel.com/t5/Intel-Software-Guard-Extensions/HELP-Maybe-something-wrong-in-defining-struct-in-Enclave/m-p/1170370#M3180</guid>
      <dc:creator>JesusG_Intel</dc:creator>
      <dc:date>2020-04-24T18:23:09Z</dc:date>
    </item>
  </channel>
</rss>

