All Projects → matiasinsaurralde → Go Dotnet

matiasinsaurralde / Go Dotnet

Licence: mit
Go wrapper for the .NET Core Runtime.

Programming Languages

golang
3204 projects

Projects that are alternatives of or similar to Go Dotnet

Aspect Injector
AOP framework for .NET (c#, vb, etc)
Stars: ✭ 398 (+7.86%)
Mutual labels:  wrapper, dotnet-core
Colore
A powerful C# library for Razer Chroma's SDK
Stars: ✭ 121 (-67.21%)
Mutual labels:  wrapper, dotnet-core
Rocksdb Sharp
.net bindings for the rocksdb by facebook
Stars: ✭ 173 (-53.12%)
Mutual labels:  wrapper, dotnet-core
Modern.forms
Cross-platform spiritual successor to Winforms for .NET Core
Stars: ✭ 323 (-12.47%)
Mutual labels:  dotnet-core
Awesome Dotnet Security
Awesome .NET Security Resources
Stars: ✭ 325 (-11.92%)
Mutual labels:  dotnet-core
Blog Core
Modular blog using Blazor with clean domain-driven design patterns
Stars: ✭ 345 (-6.5%)
Mutual labels:  dotnet-core
Pytorch Custom Cuda Tutorial
Tutorial for building a custom CUDA function for Pytorch
Stars: ✭ 369 (+0%)
Mutual labels:  wrapper
Dokan Dotnet
Dokan DotNet Wrapper
Stars: ✭ 322 (-12.74%)
Mutual labels:  wrapper
Ffmpy
Pythonic interface for FFmpeg/FFprobe command line
Stars: ✭ 360 (-2.44%)
Mutual labels:  wrapper
Three.phenomenon
⭐️ A tiny wrapper around three.js built for high-performance WebGL experiences.
Stars: ✭ 338 (-8.4%)
Mutual labels:  wrapper
Schema.net
Schema.org objects turned into strongly typed C# POCO classes for use in .NET. All classes can be serialized into JSON/JSON-LD and XML, typically used to represent structured data in the head section of html page.
Stars: ✭ 336 (-8.94%)
Mutual labels:  dotnet-core
Corefx
This repo is used for servicing PR's for .NET Core 2.1 and 3.1. Please visit us at https://github.com/dotnet/runtime
Stars: ✭ 17,924 (+4757.45%)
Mutual labels:  dotnet-core
Config
⚙ Config.Net - the easiest configuration framework for .NET developers
Stars: ✭ 349 (-5.42%)
Mutual labels:  dotnet-core
Gb28181.solution
Linux/Win/Docker/kubernetes/Chart/Kustomize/GB28181/SIP/RTP/SDP/WebRTC/作为上下级域/平台级联互联
Stars: ✭ 323 (-12.47%)
Mutual labels:  dotnet-core
Admin.core
Admin后端,前后端分离的权限管理系统,集成统一认证授权,支持国内外主流数据库自由切换和动态高级查询,基于.Net开发的WebApi
Stars: ✭ 358 (-2.98%)
Mutual labels:  dotnet-core
Umbraco Cms
The simple, flexible and friendly ASP.NET CMS used by more than 730.000 websites
Stars: ✭ 3,484 (+844.17%)
Mutual labels:  dotnet-core
Farmer
Repeatable Azure deployments with ARM templates - made easy!
Stars: ✭ 353 (-4.34%)
Mutual labels:  dotnet-core
Stprivilegedtask
An NSTask-like wrapper around the macOS Security Framework's AEWP function to run shell commands with root privileges in Objective-C / Cocoa.
Stars: ✭ 335 (-9.21%)
Mutual labels:  wrapper
Gl4es
GL4ES is a OpenGL 2.1/1.5 to GL ES 2.0/1.1 translation library, with support for Pandora, ODroid, OrangePI, CHIP, Raspberry PI, Android, Emscripten and AmigaOS4.
Stars: ✭ 333 (-9.76%)
Mutual labels:  wrapper
Altcover
Cross-platform coverage gathering and processing tool set for .net/.net core and Mono
Stars: ✭ 344 (-6.78%)
Mutual labels:  dotnet-core

go-dotnet

GoDoc MIT License Build status

This is a PoC Go wrapper for the .NET Core Runtime, this project uses cgo and has been tested under OSX. It covers two basic use cases provided by the CLR Hosting API:

  • Load and run an .exe, using its default entrypoint, just like corerun and coreconsole do, check ExecuteManagedAssembly.

  • Load a .dll, setup delegates and call them from your Go functions.

I've tried calling both C# and VB.NET methods, of course you need to generate the assembly first, check below for more details!

Note: After some tweaks it seems to work fine under Linux! Remember to install the SDK first :)

Capture

An example

package main

import (
	"github.com/matiasinsaurralde/go-dotnet"

	"fmt"
	"os"
)

func main() {
	fmt.Println("Hi, I'll initialize the .NET runtime.")

	/*
		If you don't set the TRUSTED_PLATFORM_ASSEMBLIES, it will use the default tpaList value.
		APP_PATHS & NATIVE_DLL_SEARCH_DIRECTORIES use the path of the current program,
		this makes it easier to load an assembly, just put the DLL in the same folder as your Go binary!
		You're free to override them to fit your needs.
	*/

	properties := map[string]string{
		// "TRUSTED_PLATFORM_ASSEMBLIES": "/usr/local/share/dotnet/shared/Microsoft.NETCore.App/1.0.0/mscorlib.ni.dll:/usr/local/share/dotnet/shared/Microsoft.NETCore.App/1.0.0/System.Private.CoreLib.ni.dll",
		// "APP_PATHS":                     "/Users/matias/dev/dotnet/lib/HelloWorld",
		// "NATIVE_DLL_SEARCH_DIRECTORIES": "/Users/matias/dev/dotnet/lib/HelloWorld",
	}

	/*
		CLRFilesAbsolutePath sets the SDK path.
		In case you don't set this parameter, this package will try to find the SDK using a list of common paths.
		It seems to find the right paths under Linux & OSX, feel free to override this setting (like the commented line).
	*/

	runtime, err := dotnet.NewRuntime(dotnet.RuntimeParams{
		Properties:                  properties,
		// CLRFilesAbsolutePath: "/usr/share/dotnet/shared/Microsoft.NETCore.App/1.0.0"
	})
	defer runtime.Shutdown()

	if err != nil {
		fmt.Println("Something bad happened! :(")
		os.Exit(1)
	}

	fmt.Println("Runtime loaded.")

	SayHello := runtime.CreateDelegate("HelloWorld", "HelloWorld.HelloWorld", "Hello")

    // this will call HelloWorld.HelloWorld.Hello :)
	SayHello()
}

Preparing your code (C#)

I've used dmcs (from Mono) to generate an assembly file, the original code was something like:

using System;

namespace HelloWorld {

	public class HelloWorld {
    	public static void Hello() {
      		Console.WriteLine("Hello from .NET");
    	}
	}

}

And the command:

dmcs -t:library HelloWorld.cs

Preparing your code (VisualBasic)

I did a quick test with this program, using the VB.NET compiler from Mono:

vbnc -t:library HelloWorld.vb

I'm not sure about the status of Roslyn but it could be interesting to try it.

Setup

Coming soon!

Ideas

  • Run some benchmarks.
  • Add/enhance net/http samples, like this.
  • Provide useful callbacks.
  • Support blittable types.
  • CSharpScript support.
  • Code generation tool (with go generate), a few notes here.
  • Add tests.

I'm open to PRs, Go/.NET swag, suggestions, etc.

Additional resources

Build Status

Linux x64 / Go 1.9/1.10 / .NET Core 1.0/2.0 - OS X / Go 1.9/1.10 - .NET Core 1.0/2.0

Linux and OS X build status

Windows / Go 1.9 / .NET Core 2.x

Windows build status

License

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].