{"id":16795672,"url":"https://github.com/lambdageek/monovm-embed-sample","last_synced_at":"2025-04-11T00:06:12.878Z","repository":{"id":53758359,"uuid":"325394573","full_name":"lambdageek/monovm-embed-sample","owner":"lambdageek","description":"Example showing how to embed .NET 6 MonoVM in a native C application","archived":false,"fork":false,"pushed_at":"2023-05-31T17:01:58.000Z","size":91,"stargazers_count":20,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-11T00:06:06.859Z","etag":null,"topics":["dotnet","dotnet-core","embedding","mono","net5","net6","sample-code","sample-project"],"latest_commit_sha":null,"homepage":"","language":"Makefile","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lambdageek.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-12-29T21:53:46.000Z","updated_at":"2024-09-13T17:05:55.000Z","dependencies_parsed_at":"2022-08-29T14:12:17.142Z","dependency_job_id":null,"html_url":"https://github.com/lambdageek/monovm-embed-sample","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdageek%2Fmonovm-embed-sample","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdageek%2Fmonovm-embed-sample/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdageek%2Fmonovm-embed-sample/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lambdageek%2Fmonovm-embed-sample/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lambdageek","download_url":"https://codeload.github.com/lambdageek/monovm-embed-sample/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248317707,"owners_count":21083528,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dotnet","dotnet-core","embedding","mono","net5","net6","sample-code","sample-project"],"created_at":"2024-10-13T09:17:02.397Z","updated_at":"2025-04-11T00:06:12.860Z","avatar_url":"https://github.com/lambdageek.png","language":"Makefile","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MonoVM Embedding sample #\n\n**WARNING** This code is **EXPERIMENTAL** and not supported.\n\nA sample suite of projects to show how to embed the .NET 6 MonoVM in a native desktop application.\n\n## Limitations ##\n\n* Only works on OSX or Debian 11, or Ubuntu 20.04 (other recent Linux distros may work too)  \n   This is a limitation of the sample, not a limitation of the MonoVM itself.  Embedding on other platforms where Mono works (Windows, Android, iOS) is possible.  [PRs welcome!](https://github.com/lambdageek/monovm-embed-sample/compare)\n* It needs the mono embedding hearders which are currently not included in the runtime packs ([dotnet/runtime#46461](https://github.com/dotnet/runtime/issues/46461)),\n  the sample includes them in the `vendor/mono-headers/` directory, but this is not a good idea.\n* Until [dotnet/runtime#49661](https://github.com/dotnet/runtime/issues/49661) is fixed, Linux builds need `patchelf`\n\n### Help Wanted ###\n\n* If there's a problem in the sample [open an Issue in this repo](https://github.com/lambdageek/monovm-embed-sample/issues/new/choose)\n* If the sample doesn't work [open an Issue in dotnet/runtime](https://github.com/dotnet/runtime/issues/new/choose) and mention \"Mono embedding API\"\n* If you can improve the sample [please open a PR](https://github.com/lambdageek/monovm-embed-sample/compare)\n\n## Prerequisites ##\n\n* .NET 6 SDK\n* A C compiler\n* GNU Make\n* (Linux only) [`patchelf`](https://github.com/NixOS/patchelf) (Ubuntu has a .deb package)\n\n## Building ##\n\nJust run `make` from the toplevel folder\n\n## Running ##\n\nRun `make run`, or `out/native/main` directly. (You may need to set `LD_LIBRARY_PATH` on Linux)\n\nExpected output:\n\n```console\nruntime initialized\n.NET 6.0.1\nHello From Managed\n```\n\n## Detailed description of the sample ##\n\nSee [DETAILS.md](DETAILS.md)\n\n## Using a local build of the runtime ##\n\nThis is the process for using this sample with a local build of the runtime.\n\n### Building the runtime ###\n\nBuild a checkout of dotnet/runtime using something like\n\n```console\n./build.sh -s mono+libs -c Release\n```\n\nVerify that `artifacts/bin/microsoft.netcore.app.runtime.osx-x64/Release` (or\nother RID and configuration) exists.  It should contain a\n`runtimes/osx-x64/native` directory.  The makefile dependson it.\n\n### Local build limitations ###\n\n1. The `CsharpSample` is compiled using a normal (installed) `dotnet` SDK, so\nit won't be able to directly use any new managed APIs from the dotnet/runtime\ncheckout.  If the new API is in `System.Private.CoreLib.dll`, you may be able\nto call it using reflection.\n\n2. We will take most libraries from the normal installed dotnet runtime, the\nonly thing we pick up from the local build is `libcoreclr.dylib` and\n`System.Private.CoreLib.dll` this may lead to broken apps.\n\n3. If you add a new `MONO_API` and want ot use it in the native sample, you\n   will need to update the headers in `vendor/mono-headers` to include it.\n\n### Building the sample ###\n\nPass the `LOCAL_RUNTIME` variable on the `make` command line:\n\n```console\nmake LOCAL_RUNTIME=~/work/runtime/artifacts/bin/microsoft.netcore.app.runtime.osx-x64/Release\nmake LOCAL_RUNTIME=~/work/runtime/artifacts/bin/microsoft.netcore.app.runtime.osx-x64/Release run\n```\n\nThe output from running should be\n\n```console\nruntime initialized\n.NET 7.0.0-dev\nHello From Managed\n```\n\nIf it doesn't say `.NET 7.0.0-dev` it's not using the local build.\n\nWhen in doubt, `rm -rf out/` and try again.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flambdageek%2Fmonovm-embed-sample","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flambdageek%2Fmonovm-embed-sample","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flambdageek%2Fmonovm-embed-sample/lists"}