if(CLR_CMAKE_PLATFORM_UNIX)
add_subdirectory(src/ToolBox/SOS/lldbplugin)
add_subdirectory(src/pal)
- add_subdirectory(src/coreclr/hosts/unixcoreruncommon)
- add_subdirectory(src/coreclr/hosts/unixcorerun)
- add_subdirectory(src/coreclr/hosts/unixcoreconsole)
+ add_subdirectory(src/coreclr/hosts)
add_subdirectory(src/ildasm/unixcoreclrloader)
endif(CLR_CMAKE_PLATFORM_UNIX)
-if(CLR_CMAKE_PLATFORM_DARWIN)
- add_subdirectory(src/coreclr/hosts/osxbundlerun)
-endif(CLR_CMAKE_PLATFORM_DARWIN)
-
# Add this subdir. We install the headers for the jit.
add_subdirectory(src/pal/prebuilt/inc)
include_directories("${LLDB_H}")
include_directories(${CLR_DIR}/src/debug/inc)
include_directories(${CLR_DIR}/src/inc)
+include_directories(${CLR_DIR}/src/coreclr/hosts/inc)
include_directories(${CLR_DIR}/src/coreclr/hosts/unixcoreruncommon)
set(SOURCES
endif()
# add the install targets
-install_clr(sosplugin)
\ No newline at end of file
+install_clr(sosplugin)
# Add the Merge flag here is needed. Not needed for RyuJIT if building as a DLL.
add_definitions(-DFEATURE_MERGE_JIT_AND_ENGINE)
-
-add_subdirectory(hosts)
+if(WIN32)
+ add_subdirectory(hosts)
+endif(WIN32)
-add_subdirectory(corerun)
-add_subdirectory(coreconsole)
+include_directories(inc)
+if(WIN32)
+ add_subdirectory(corerun)
+ add_subdirectory(coreconsole)
+else(WIN32)
+ add_subdirectory(unixcoreruncommon)
+ add_subdirectory(unixcorerun)
+ add_subdirectory(unixcoreconsole)
+ if(CLR_CMAKE_PLATFORM_DARWIN)
+ add_subdirectory(osxbundlerun)
+ endif(CLR_CMAKE_PLATFORM_DARWIN)
+endif(WIN32)
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+//
+// APIs for hosting CoreCLR
+//
+
+#ifndef __CORECLR_HOST_H__
+#define __CORECLR_HOST_H__
+
+// For each hosting API, we define a function prototype and a function pointer
+// The prototype is useful for implicit linking against the dynamic coreclr
+// library and the pointer for explicit dynamic loading (dlopen, LoadLibrary)
+#define CORECLR_HOSTING_API(function, ...) \
+ extern "C" int function(__VA_ARGS__); \
+ typedef int (*function##_ptr)(__VA_ARGS__)
+
+CORECLR_HOSTING_API(coreclr_initialize,
+ const char* exePath,
+ const char* appDomainFriendlyName,
+ int propertyCount,
+ const char** propertyKeys,
+ const char** propertyValues,
+ void** hostHandle,
+ unsigned int* domainId);
+
+CORECLR_HOSTING_API(coreclr_shutdown,
+ void* hostHandle,
+ unsigned int domainId);
+
+CORECLR_HOSTING_API(coreclr_create_delegate,
+ void* hostHandle,
+ unsigned int domainId,
+ const char* entryPointAssemblyName,
+ const char* entryPointTypeName,
+ const char* entryPointMethodName,
+ void** delegate);
+
+CORECLR_HOSTING_API(coreclr_execute_assembly,
+ void* hostHandle,
+ unsigned int domainId,
+ int argc,
+ const char** argv,
+ const char* managedAssemblyPath,
+ unsigned int* exitCode);
+
+#undef CORECLR_HOSTING_API
+
+#endif // __CORECLR_HOST_H__
#include <string.h>
#include <sys/stat.h>
#include "coreruncommon.h"
+#include "coreclrhost.h"
#include <unistd.h>
#define SUCCEEDED(Status) ((Status) >= 0)
// used in the same way as serverGcVar. Concurrent GC is on by default.
static const char* concurrentGcVar = "CORECLR_CONCURRENT_GC";
-// Prototype of the coreclr_initialize function from the libcoreclr.so
-typedef int (*InitializeCoreCLRFunction)(
- const char* exePath,
- const char* appDomainFriendlyName,
- int propertyCount,
- const char** propertyKeys,
- const char** propertyValues,
- void** hostHandle,
- unsigned int* domainId);
-
-// Prototype of the coreclr_shutdown function from the libcoreclr.so
-typedef int (*ShutdownCoreCLRFunction)(
- void* hostHandle,
- unsigned int domainId);
-
-// Prototype of the coreclr_execute_assembly function from the libcoreclr.so
-typedef int (*ExecuteAssemblyFunction)(
- void* hostHandle,
- unsigned int domainId,
- int argc,
- const char** argv,
- const char* managedAssemblyPath,
- unsigned int* exitCode);
-
#if defined(__linux__)
#define symlinkEntrypointExecutable "/proc/self/exe"
#elif !defined(__APPLE__)
void* coreclrLib = dlopen(coreClrDllPath.c_str(), RTLD_NOW | RTLD_LOCAL);
if (coreclrLib != nullptr)
{
- InitializeCoreCLRFunction initializeCoreCLR = (InitializeCoreCLRFunction)dlsym(coreclrLib, "coreclr_initialize");
- ExecuteAssemblyFunction executeAssembly = (ExecuteAssemblyFunction)dlsym(coreclrLib, "coreclr_execute_assembly");
- ShutdownCoreCLRFunction shutdownCoreCLR = (ShutdownCoreCLRFunction)dlsym(coreclrLib, "coreclr_shutdown");
+ coreclr_initialize_ptr initializeCoreCLR = (coreclr_initialize_ptr)dlsym(coreclrLib, "coreclr_initialize");
+ coreclr_execute_assembly_ptr executeAssembly = (coreclr_execute_assembly_ptr)dlsym(coreclrLib, "coreclr_execute_assembly");
+ coreclr_shutdown_ptr shutdownCoreCLR = (coreclr_shutdown_ptr)dlsym(coreclrLib, "coreclr_shutdown");
if (initializeCoreCLR == nullptr)
{