title: how to return a struct from V8 C++ function to javascript module
body: <p>I am new to Javascript and V8 library. My requirement is call a C++ function and return a C struct back to Javascript module.</p>
  
  <pre><code>struct empDetails {
      int empNo;
      string empName;
  };
  
  v8::Handle&lt;v8::Value&gt; getDetails(const v8::Arguments &amp;args) {
      if ((args.Length() != 1) || !args[0]-&gt;IsUint32()) {
          return v8::ThrowException(v8::Exception::Error    
                  (v8::String::New("Invalid&gt; arguments.")));
      }
      uint32_t userId = args[0]-&gt;ToUint32()-&gt;Value();
      empDetails e;
      company::GetEmpdetails(userId, e); // other static function in my project
      return e;
  }
  </code></pre>
  
  <p>At return statement, I am getting error. Could anyone tell me how to return a struct from V8 C++ function.</p>