check runtime initialize before launch application to avoid crash
[platform/core/dotnet/launcher.git] / NativeLauncher / launcher / dotnet / dotnet_launcher.h
index 31a8c4a..647640a 100644 (file)
  * limitations under the License.
  */
 
-#include "launcher.h"
-
-extern "C"
-{
-  typedef int (*coreclr_initialize_ptr)(
-      const char* exePath,
-      const char* appDomainFriendlyName,
-      int propertyCount,
-      const char** propertyKeys,
-      const char** propertyValues,
-      void** hostHandle,
-      unsigned int* domainId);
-
-  typedef int (*coreclr_execute_assembly_ptr)(
-      void* hostHandle,
-      unsigned int domainId,
-      int argc,
-      const char** argv,
-      const char* managedAssemblyPath,
-      unsigned int* exitCode);
-
-  typedef int (*coreclr_shutdown_ptr)(
-      void* hostHandle,
-      unsigned int domainId);
+#ifndef __DOTNET_LAUNCHER_H__
+#define __DOTNET_LAUNCHER_H__
 
-  typedef int (*coreclr_create_delegate_ptr)(
-      void* hostHandle,
-      unsigned int domainId,
-      const char* entryPointAssemblyName,
-      const char* entryPointTypeName,
-      const char* entryPointMethodName,
-      void** delegate);
-}
+#include "launcher.h"
+#include "coreclr_host.h"
+#include "plugin_manager.h"
 
 namespace tizen {
 namespace runtime {
 namespace dotnetcore {
 
-typedef void (*PreparedFunctionPtr)();
-typedef bool (*LaunchFunctionPtr)(const char* root, const char* path, int argc, char* argv[]);
-
-class CoreRuntime : public tizen::runtime::LauncherInterface
+class CoreRuntime
 {
-  public:
-    CoreRuntime();
-    ~CoreRuntime();
-    int Initialize(bool standalone) override;
-    void Dispose() override;
-    int RunManagedLauncher() override;
-    int Launch(const char* root, const char* path, int argc, char* argv[]) override;
-
-  private:
-    bool InitializeCoreClr(const char* assembly_probe_paths, const char* pinvoke_probe_paths);
-    coreclr_initialize_ptr InitializeClr;
-    coreclr_execute_assembly_ptr ExecuteAssembly;
-    coreclr_shutdown_ptr Shutdown;
-    coreclr_create_delegate_ptr CreateDelegate;
-    std::string DeviceAPIDirectory;
-    std::string RuntimeDirectory;
-    std::string LauncherAssembly;
-    void* coreclrLib;
-    void* hostHandle;
-    unsigned int domainId;
-    PreparedFunctionPtr PreparedFunction;
-    LaunchFunctionPtr LaunchFunction;
+       public:
+               CoreRuntime(const char* mode);
+               ~CoreRuntime();
+               int initialize(bool standalone);
+               void dispose();
+               int launch(const char* appId, const char* root, const char* path, int argc, char* argv[]);
+
+       private:
+               bool initializeCoreClr(const char* appId, const char* assemblyProbePaths, const char* pinvokeProbePaths, const char* tpaList);
+               coreclr_initialize_ptr initializeClr;
+               coreclr_execute_assembly_ptr executeAssembly;
+               coreclr_shutdown_ptr shutdown;
+               coreclr_create_delegate_ptr createDelegate;
+               std::string __nativeLibDirectory;
+               void* __coreclrLib;
+               void* __hostHandle;
+               unsigned int __domainId;
+               int fd;
+               const char* __mode;
+               bool __initialized;
 };
 
 }  // dotnetcore
 }  // namespace runtime
 }  // namespace tizen
+
+#endif /* __DOTNET_LAUNCHER_H__ */
\ No newline at end of file