Nebula
Loading...
Searching...
No Matches
Scripting::NSharpServer Class Reference

#include <nsharpserver.h>

Detailed Description

C# backend for the Nebula scripting subsystem.

Main goals for the nSharp library: Fast compilation times. Hot reloading.

(C) 2019 Individual contributors, see AUTHORS file

Inherits Core::RefCounted.

Classes

struct  Assembly

Public Member Functions

 NSharpServer ()
 constructor
virtual ~NSharpServer ()
 destructor
bool Open ()
 open the script server
void Close ()
 close the script server
void SetDebuggingEnabled (bool enabled)
 enable debugging. this needs to be called before Open()
void WaitForDebuggerToConnect (bool enabled)
AssemblyId LoadAssembly (IO::URI const &uri)
 Load dotnet exe or DLL at path.
int ExecUnmanagedCall (AssemblyId assemblyId, Util::String const &function)
 Execute function in an assembly. This is not very efficient and should not be used in place of delegates.
bool const IsOpen ()
 Check if server is open.
void * GetDelegatePointer (AssemblyId assemblyId, Util::String const &assemblyQualifiedFunctionName, Util::String const &assemblyQualifiedDelegateName)
 Get a delegate pointer from an assembly.
void * GetUnmanagedFuncPointer (AssemblyId assemblyId, Util::String const &assemblyQualifiedFunctionName)
 Get a function pointer ([UnmanagedCallersOnly]) from an assembly.
Public Member Functions inherited from Core::RefCounted
 RefCounted ()
 constructor
int GetRefCount () const
 get the current refcount
void AddRef ()
 increment refcount by one
void Release ()
 decrement refcount and destroy object if refcount is zero
bool IsInstanceOf (const Rtti &rtti) const
 return true if this object is instance of given class
bool IsInstanceOf (const Util::String &className) const
 return true if this object is instance of given class by string
bool IsInstanceOf (const Util::FourCC &classFourCC) const
 return true if this object is instance of given class by fourcc
bool IsA (const Rtti &rtti) const
 return true if this object is instance of given class, or a derived class
bool IsA (const Util::String &rttiName) const
 return true if this object is instance of given class, or a derived class, by string
bool IsA (const Util::FourCC &rttiFourCC) const
 return true if this object is instance of given class, or a derived class, by fourcc
const Util::StringGetClassName () const
 get the class name
Util::FourCC GetClassFourCC () const
 get the class FourCC code

Private Member Functions

 __DeclareClass (NSharpServer)
 __DeclareSingleton (NSharpServer)
bool LoadHostFxr ()
 load the host fxr library and get exported function addresses
void CloseHostFxr ()

Private Attributes

Util::ArrayAllocator< Assembly * > assemblies
Util::Dictionary< Util::String, uint32_t > assemblyTable
bool debuggerEnabled
bool waitForDebugger
bool isOpen
System::Library hostfxr

Additional Inherited Members

Static Public Member Functions inherited from Core::RefCounted
static void DumpRefCountingLeaks ()
 dump refcounting leaks, call at end of application (NEBULA_DEBUG builds only!)
Protected Member Functions inherited from Core::RefCounted
virtual ~RefCounted ()
 destructor (called when refcount reaches zero)

Constructor & Destructor Documentation

◆ NSharpServer()

Scripting::NSharpServer::NSharpServer ( )

constructor

◆ ~NSharpServer()

Scripting::NSharpServer::~NSharpServer ( )
virtual

destructor

Member Function Documentation

◆ __DeclareClass()

Scripting::NSharpServer::__DeclareClass ( NSharpServer )
private

◆ __DeclareSingleton()

Scripting::NSharpServer::__DeclareSingleton ( NSharpServer )
private

◆ Close()

void Scripting::NSharpServer::Close ( )

close the script server

◆ CloseHostFxr()

void Scripting::NSharpServer::CloseHostFxr ( )
private

◆ ExecUnmanagedCall()

int Scripting::NSharpServer::ExecUnmanagedCall ( AssemblyId assemblyId,
Util::String const & function )

Execute function in an assembly. This is not very efficient and should not be used in place of delegates.

Function should be formatted as: "Namespace.Namespace.Class+NestedClass::Function()".

◆ GetDelegatePointer()

void * Scripting::NSharpServer::GetDelegatePointer ( AssemblyId assemblyId,
Util::String const & assemblyQualifiedFunctionName,
Util::String const & assemblyQualifiedDelegateName )

Get a delegate pointer from an assembly.

Function should be formatted as: "Namespace.Namespace.Class+NestedClass::Function()".

◆ GetUnmanagedFuncPointer()

void * Scripting::NSharpServer::GetUnmanagedFuncPointer ( AssemblyId assemblyId,
Util::String const & assemblyQualifiedFunctionName )

Get a function pointer ([UnmanagedCallersOnly]) from an assembly.

Function should be formatted as: "Namespace.Namespace.Class+NestedClass::Function()".

◆ IsOpen()

bool const Scripting::NSharpServer::IsOpen ( )

Check if server is open.

◆ LoadAssembly()

AssemblyId Scripting::NSharpServer::LoadAssembly ( IO::URI const & uri)

Load dotnet exe or DLL at path.

◆ LoadHostFxr()

bool Scripting::NSharpServer::LoadHostFxr ( )
private

load the host fxr library and get exported function addresses

Using the nethost library, discover the location of hostfxr and get exports.

◆ Open()

bool Scripting::NSharpServer::Open ( )

open the script server

◆ SetDebuggingEnabled()

void Scripting::NSharpServer::SetDebuggingEnabled ( bool enabled)

enable debugging. this needs to be called before Open()

◆ WaitForDebuggerToConnect()

void Scripting::NSharpServer::WaitForDebuggerToConnect ( bool enabled)

Member Data Documentation

◆ assemblies

Util::ArrayAllocator<Assembly*> Scripting::NSharpServer::assemblies
private

◆ assemblyTable

Util::Dictionary<Util::String, uint32_t> Scripting::NSharpServer::assemblyTable
private

◆ debuggerEnabled

bool Scripting::NSharpServer::debuggerEnabled
private

◆ hostfxr

System::Library Scripting::NSharpServer::hostfxr
private

◆ isOpen

bool Scripting::NSharpServer::isOpen
private

◆ waitForDebugger

bool Scripting::NSharpServer::waitForDebugger
private

The documentation for this class was generated from the following files: