GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - PowerShell/PowerShell-Native

BranchesTags
Open more actions menu

Latest commit

 

History

90 Commits
90 Commits

Folders and files

NameName
Last commit message
Last commit date
.config
.config
 
 
.github
.github
 
 
.pipelines
.pipelines
 
 
.vsts-ci
.vsts-ci
 
 
assets
assets
 
 
docker
docker
 
 
src
src
 
 
tools
tools
 
 
.editorconfig
.editorconfig
 
 
.gitignore
.gitignore
 
 
.gitmodules
.gitmodules
 
 
CODE_OF_CONDUCT.md
CODE_OF_CONDUCT.md
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 
azurepipelines-coverage.yml
azurepipelines-coverage.yml
 
 
build-release.log
build-release.log
 
 
build.psm1
build.psm1
 
 
es-metadata.yml
es-metadata.yml
 
 
owners.txt
owners.txt
 
 

Repository files navigation

libpsl-native

This library provides functionality missing from .NET Core via system calls, that are called from from the CorePsPlatform.cs file of PowerShell. The method to do this is a Platform Invoke, which is C#'s Foreign Function Interface to C code (and C++ by way of extern C).

Build

CMake is used to build the project, which results in a libpsl-native.so library on Linux, and libpsl-native.dylib on OS X.

cmake -DCMAKE_BUILD_TYPE=Debug .
make -j

Test

The Google Test framework is used for unit tests.

Use either make test or ctest --verbose for more output.

Notes

Marshalling data from native to managed code is much easier on Linux than it is on Windows. For instance, to return a string, you simply return a copy of it on the heap. Since only one memory allocator is used on Linux, the .NET runtime has no problem later freeing the buffer. Additionally, .NET presumes that the codepage "Ansi" on Linux is always UTF-8. So just marshal the string as UnmanagedType.LPStr.

C# (Managed)

[DllImport("libpsl-native", CharSet = CharSet.Ansi)]
[return: MarshalAs(UnmanagedType.LPStr)]
internal static extern string GetSomeString();

C (Native)

char *GetSomeString()
{
    return strdup("some string");
}

The CoreFX team has an excellent guide for UNIX Interop.

Code of Conduct

Please see our Code of Conduct before participating in this project.

Security Policy

For any security issues, please see our Security Policy.

About

No description, website, or topics provided.

Resources

Readme
MIT license

Code of conduct

Code of conduct

Contributing

Contributing

Security policy

Security policy
Activity
Custom properties

Stars

69 stars

Watchers

6 watching

Forks

46 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.