{"id":19174989,"url":"https://github.com/losttech/openxr.pinvoke","last_synced_at":"2025-04-09T20:52:50.738Z","repository":{"id":124319910,"uuid":"244271709","full_name":"losttech/OpenXR.PInvoke","owner":"losttech","description":"Raw PInvoke bindings for OpenXR","archived":false,"fork":false,"pushed_at":"2020-03-02T03:43:05.000Z","size":15,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T20:52:44.578Z","etag":null,"topics":["csharp","dotnet","openxr","pinvoke","vr","xr"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/losttech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-03-02T03:29:36.000Z","updated_at":"2020-10-29T23:34:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"33ef9a7f-df1d-4fc3-8576-3ff0c866ad1b","html_url":"https://github.com/losttech/OpenXR.PInvoke","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/losttech%2FOpenXR.PInvoke","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/losttech%2FOpenXR.PInvoke/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/losttech%2FOpenXR.PInvoke/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/losttech%2FOpenXR.PInvoke/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/losttech","download_url":"https://codeload.github.com/losttech/OpenXR.PInvoke/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248111980,"owners_count":21049577,"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":["csharp","dotnet","openxr","pinvoke","vr","xr"],"created_at":"2024-11-09T10:20:15.876Z","updated_at":"2025-04-09T20:52:50.712Z","avatar_url":"https://github.com/losttech.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Getting started on Windows\n\n1. Create a new *.NET Core* WPF or Windows Forms project\n1. Add a reference to OpenXR.PInvoke package\n2. Allow unsafe code:\n```xml\n\u003cPropertyGroup\u003e\n  \u003cAllowUnsafeBlocks\u003etrue\u003c/AllowUnsafeBlocks\u003e\n\u003c/PropertyGroup\u003e\n```\n3. Reference OpenXR.Loader package\n4. Modify `.csproj` file to have these (works on Windows only)\n```xml\n\u003cItemGroup\u003e\n  \u003cPackageReference Include=\"OpenXR.Loader\" Version=\"1.0.6.2\" GeneratePathProperty=\"true\" /\u003e\n\u003c/ItemGroup\u003e\n\n\u003cItemGroup\u003e\n  \u003cOpenXRBinaries Include=\"$(PkgOpenXR_Loader)/native/**/bin/openxr_loader.*\" /\u003e\n\u003c/ItemGroup\u003e\n\n\u003cTarget Name=\"CopyOpenXRLoaderFiles\" AfterTargets=\"Build\"\u003e\n  \u003cCopy SourceFiles=\"@(OpenXRBinaries)\" DestinationFiles=\"@(OpenXRBinaries-\u003e'$(OutDir)native\\%(RecursiveDir)%(Filename)%(Extension)')\" /\u003e\n\u003c/Target\u003e\n```\n5. Add a custom native library resolver (works as is on Windows only):\n```csharp\nNativeLibrary.SetDllImportResolver(typeof(OpenXR.PInvoke.XR).Assembly, Resolver);\n\nstatic IntPtr Resolver(string libraryname, Assembly assembly, DllImportSearchPath? searchpath) {\n    if (libraryname != \"openxr_loader\") return IntPtr.Zero;\n\n    string installDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);\n    if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))\n        throw new PlatformNotSupportedException();\n\n    string bitness = IntPtr.Size switch {\n        4 =\u003e \"Win32\",\n        8 =\u003e \"x64\",\n        _ =\u003e throw new PlatformNotSupportedException(),\n    };\n\n    string path = Path.Combine(new[] {\n        installDir, \"native\", bitness, \"release\", \"bin\",\n        Path.ChangeExtension(libraryname, \".dll\"),\n    });\n\n    return NativeLibrary.Load(path);\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flosttech%2Fopenxr.pinvoke","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flosttech%2Fopenxr.pinvoke","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flosttech%2Fopenxr.pinvoke/lists"}