Code Monkey home page Code Monkey logo

nethost's Introduction

Net Host

This is literally just some testing I've done with hosting .NET Core in native applications.

Again, this is just me trying to invoke a managed method. This is a full-on mess, even the outputs aren't organized.

What this does, all in all, is it contains two projects - Native and TestModule:

  • Native is a C++ project that will prompt the user to provide the path to the hostfxr.dll and the compiled TestModule's root.
  • TestModule is a C# Code Library that only has one function, called Test, inside class Module, in namespace TestModule, that prints to stdout.

Important

This is for educational purposes only.

The code is badly written and messy, very static and hard-coded and generally only shows how to approach accessing the .NET Core. I've only shared it as I believe it could potentially help someone in the future but it is not a good source. A great example of doing this properly would be Godot's implementation, and even that one has plenty that can be improved!

Some Limitations

So, since this was really a concentrated test on just invoking a managed method from C++, there's plenty of things that should probably be done and are not addressed at all in here (although they are surprisingly easy in theory):

  • Automatically finding hostfxr.dll (and for the love of god - do not use get_hostfxr_path!!!)
  • Calling functions with different parameters and return types
  • Remove all hardcoding from there, possibly load data from the user or JSON or something else
  • Allow loading DLLs without a runtimeconfig (this is actually really easy, just pretend the DLL is a console app, apparently!)

nethost's People

Contributors

sleepymode avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.