{"id":15021154,"url":"https://github.com/powershell/powershell-native","last_synced_at":"2025-05-15T21:04:22.065Z","repository":{"id":43826961,"uuid":"134639849","full_name":"PowerShell/PowerShell-Native","owner":"PowerShell","description":null,"archived":false,"fork":false,"pushed_at":"2025-03-31T22:21:37.000Z","size":928,"stargazers_count":51,"open_issues_count":9,"forks_count":35,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-19T02:16:33.258Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","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/PowerShell.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-05-24T00:26:05.000Z","updated_at":"2025-04-04T03:35:35.000Z","dependencies_parsed_at":"2023-02-16T22:31:36.707Z","dependency_job_id":"dfa8daa3-c969-45d0-bd75-2c6e0e4a460a","html_url":"https://github.com/PowerShell/PowerShell-Native","commit_stats":{"total_commits":79,"total_committers":17,"mean_commits":4.647058823529412,"dds":0.4177215189873418,"last_synced_commit":"482c219b91dc81970a9c1050c880a874d403ddc6"},"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerShell%2FPowerShell-Native","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerShell%2FPowerShell-Native/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerShell%2FPowerShell-Native/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PowerShell%2FPowerShell-Native/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PowerShell","download_url":"https://codeload.github.com/PowerShell/PowerShell-Native/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254422754,"owners_count":22068678,"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":[],"created_at":"2024-09-24T19:56:12.072Z","updated_at":"2025-05-15T21:04:22.046Z","avatar_url":"https://github.com/PowerShell.png","language":"C++","readme":"# libpsl-native\n\nThis library provides functionality missing from .NET Core via system calls,\nthat are called from from the `CorePsPlatform.cs` file of PowerShell. The\nmethod to do this is a Platform Invoke, which is C#'s Foreign Function\nInterface to C code (and C++ by way of `extern C`).\n\n## Build\n\n[CMake][] is used to build the project, which results in a `libpsl-native.so`\nlibrary on Linux, and `libpsl-native.dylib` on OS X.\n\n```sh\ncmake -DCMAKE_BUILD_TYPE=Debug .\nmake -j\n```\n\n[CMake]: https://cmake.org/cmake/help/v2.8.12/cmake.html\n\n## Test\n\nThe [Google Test][] framework is used for unit tests.\n\nUse either `make test` or `ctest --verbose` for more output.\n\n[Google Test]: https://github.com/google/googletest/tree/release-1.7.0\n\n## Notes\n\nMarshalling data from native to managed code is much easier on Linux than it is\non Windows. For instance, to return a string, you simply return a copy of it on\nthe heap. Since only one memory allocator is used on Linux, the .NET runtime\nhas no problem later freeing the buffer. Additionally, .NET presumes that the\ncodepage \"Ansi\" on Linux is always UTF-8. So just marshal the string as\n`UnmanagedType.LPStr`.\n\n### C# (Managed)\n\n```c#\n[DllImport(\"libpsl-native\", CharSet = CharSet.Ansi)]\n[return: MarshalAs(UnmanagedType.LPStr)]\ninternal static extern string GetSomeString();\n```\n\n### C (Native)\n\n```c\nchar *GetSomeString()\n{\n    return strdup(\"some string\");\n}\n```\n\nThe CoreFX team has an excellent guide for [UNIX Interop][].\n\n[UNIX Interop]: https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/interop-guidelines.md#unix-shims\n\n## Code of Conduct\n\nPlease see our [Code of Conduct](CODE_OF_CONDUCT.md) before participating in this project.\n\n## Security Policy\n\nFor any security issues, please see our [Security Policy](.github/SECURITY.md).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpowershell%2Fpowershell-native","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpowershell%2Fpowershell-native","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpowershell%2Fpowershell-native/lists"}