check runtime initialize before launch application to avoid crash
[platform/core/dotnet/launcher.git] / NativeLauncher / launcher / dotnet / dotnet_launcher.h
index 931846c..647640a 100644 (file)
 #define __DOTNET_LAUNCHER_H__
 
 #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);
-
-       typedef int (*coreclr_create_delegate_ptr)(
-                       void* hostHandle,
-                       unsigned int domainId,
-                       const char* entryPointAssemblyName,
-                       const char* entryPointTypeName,
-                       const char* entryPointMethodName,
-                       void** delegate);
-
-       typedef void (*plugin_initialize_ptr)();
-
-       typedef void (*plugin_preload_ptr)();
-
-       typedef void (*plugin_set_app_info_ptr)(
-                       const char* appId,
-                       const char* hostHandle);
-
-       typedef char* (*plugin_get_dll_path_ptr)();
-
-       typedef void (*plugin_before_execute_ptr)();
-
-       typedef void (*plugin_finalize_ptr)();
-}
+#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(const char* mode);
                ~CoreRuntime();
-               int initialize(bool standalone) override;
-               void dispose() override;
-               int runManagedLauncher(const char* appId, const char* appBase, const char* tpaList) override;
-               int launch(const char* appId, const char* root, const char* path, int argc, char* argv[]) override;
+               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);
@@ -88,24 +40,13 @@ class CoreRuntime : public tizen::runtime::LauncherInterface
                coreclr_execute_assembly_ptr executeAssembly;
                coreclr_shutdown_ptr shutdown;
                coreclr_create_delegate_ptr createDelegate;
-               std::string __deviceAPIDirectory;
-               std::string __runtimeDirectory;
-               std::string __launcherAssembly;
                std::string __nativeLibDirectory;
-               std::string __refAPIDirectory;
                void* __coreclrLib;
                void* __hostHandle;
                unsigned int __domainId;
-               PreparedFunctionPtr preparedFunction;
-               LaunchFunctionPtr launchFunction;
-               // plugin function pointer
-               void* __pluginLib;
-               plugin_initialize_ptr pluginInitialize;
-               plugin_preload_ptr      pluginPreload;
-               plugin_set_app_info_ptr pluginSetAppInfo;
-               plugin_get_dll_path_ptr pluginGetDllPath;
-               plugin_before_execute_ptr pluginBeforeExecute;
-               plugin_finalize_ptr     pluginFinalize;
+               int fd;
+               const char* __mode;
+               bool __initialized;
 };
 
 }  // dotnetcore