title: How to call a method added to the windows native module of Appelerator Platform
body: <p>We write to ask how to correctly call a method of Titanium Appelerator native module. 
  Our development environment is as the following:</p>
  
  <blockquote>
    <p>Titanium SDK :5.2.0<br/>
    Appcelerator CLI: 5.2.0<br/>
    TabletPC:Windows10pro<br/></p>
  </blockquote>
  
  <p>Our module has been developed with the following procedures;</p>
  
  <p>(1) we created a module referring to the document of  <a href="https://github.com/appcelerator/titanium_mobile_windows#module-development" rel="nofollow">https://github.com/appcelerator/titanium_mobile_windows#module-development</a>
  An additional method aaa() was added to the module.</p>
  
  <pre><code>cd MY_WORKSPACE
  ti create -p windows -t module //create a module project
  cd MY_MODULE_NAME/windows
  ti build -p windows -T ws-local //build my module project
  </code></pre>
  
  <p>(2) A windows’ application was created to call the above module, and there was no error while we call the module from the application. However, while we call the method aaa(), Titanium error message as the following occurred;
  “aaa() method does not exist”.</p>
  
  <p>In the Titanium windows platform for windows10, the dll for module was created correctly. Then, we are just wondering which parts of our source are not correct;</p>
  
  <p>(1)        The definition of a method aaa()is not correct.
  (2)        The source code to call the native module is not correct.
  (3)        The source code to call the aaa() method is not correct.</p>
  
  <p>We attached our source code as the following and thank you in advance for your comment and advice. </p>
  
  <p>The code is as below.</p>
  
  <p>windows/src/JpNativeModuleExample.cpp</p>
  
  <pre><code>#include "JpNativeModuleExample.hpp"
  #include "Titanium/detail/TiImpl.hpp"
  
  namespace Jp
  {
          NativeModuleExample::NativeModuleExample(const JSContext&amp; js_context) TITANIUM_NOEXCEPT
                  : JSExportObject(js_context)
          {
                  TITANIUM_LOG_DEBUG("NativeModuleExample::ctor Initialize");
          }
  
          void NativeModuleExample::postInitialize(JSObject&amp; js_object)
          {
          }
  
          void NativeModuleExample::postCallAsConstructor(const JSContext&amp; js_context, const std::vector&lt;JSValue&gt;&amp; arguments)
          {
          }
  
          //add new method
          void NativeModuleExample::aaa() TITANIUM_NOEXCEPT
          {
          }
  
          void NativeModuleExample::JSExportInitialize()
          {
                  JSExport&lt;NativeModuleExample&gt;::SetClassVersion(1);
                  JSExport&lt;NativeModuleExample&gt;::SetParent(JSExport&lt;JSExportObject&gt;::Class());
          }
  }
  </code></pre>
  
  <p>windows/include/JpNativeModuleExample.hpp</p>
  
  <pre><code>#ifndef _JPNATIVEMODULEEXAMPLE_HPP_
  #define _JPNATIVEMODULEEXAMPLE_HPP_
  
  #include "JpNativeModuleExample_EXPORT.h"
  #include "Titanium/detail/TiBase.hpp"
  #include "Titanium/Module.hpp"
  
  namespace Jp
  {
          using namespace HAL;
  
          class JPNATIVEMODULEEXAMPLE_EXPORT NativeModuleExample : public JSExportObject, public JSExport&lt;NativeModuleExample&gt;
          {
                  public:
                          NativeModuleExample(const JSContext&amp;) TITANIUM_NOEXCEPT;
                          void aaa() TITANIUM_NOEXCEPT;
                          virtual void postInitialize(JSObject&amp; js_object) override;
                          virtual void postCallAsConstructor(const JSContext&amp; js_context, const std::vector&lt;JSValue&gt;&amp; arguments) override;
  
                          virtual void aaa();        //add new method
  
                          virtual ~NativeModuleExample()                             = default;
                          NativeModuleExample(const NativeModuleExample&amp;)            = default;
                          NativeModuleExample&amp; operator=(const NativeModuleExample&amp;) = default;
  #ifdef TITANIUM_MOVE_CTOR_AND_ASSIGN_DEFAULT_ENABLE
                          NativeModuleExample(NativeModuleExample&amp;&amp;)                 = default;
                          NativeModuleExample&amp; operator=(NativeModuleExample&amp;&amp;)      = default;
  #endif
  
                          static void JSExportInitialize();
  
          };
  }
  #endif // _JPNATIVEMODULEEXAMPLE_HPP_
  </code></pre>
  
  <p>sample code</p>
  
  <pre><code>var nativemoduleexample = require('jp.NativeModuleExample');
  Ti.API.info("module is =&gt; " + nativemoduleexample); //no problem
  var aaa = nativemoduleexample.aaa();　//titanium error is displayed
  
  $.index.open();
  </code></pre>