FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Update README files for native code for migration (#7248) · PowerShell/PowerShell@749d160 · GitHub

Commit 749d160

Browse files
Update README files for native code for migration (#7248)
1 parent e5e1c53 commit 749d160

2 files changed

Lines changed: 8 additions & 54 deletions

File tree

‎src/libpsl-native/README.md‎

Lines changed: 3 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,5 @@
11
# libpsl-native
22

3-
This library provides functionality missing from .NET Core via system calls,
4-
that are called from from the `CorePsPlatform.cs` file of PowerShell. The
5-
method to do this is a Platform Invoke, which is C#'s Foreign Function
6-
Interface to C code (and C++ by way of `extern C`).
7-
8-
## Build
9-
10-
[CMake][] is used to build the project, which results in a `libpsl-native.so`
11-
library on Linux, and `libpsl-native.dylib` on OS X.
12-
13-
```sh
14-
cmake -DCMAKE_BUILD_TYPE=Debug .
15-
make -j
16-
```
17-
18-
[CMake]: https://cmake.org/cmake/help/v2.8.12/cmake.html
19-
20-
## Test
21-
22-
The [Google Test][] framework is used for unit tests.
23-
24-
Use either `make test` or `ctest --verbose` for more output.
25-
26-
[Google Test]: https://github.com/google/googletest/tree/release-1.7.0
27-
28-
## Notes
29-
30-
Marshalling data from native to managed code is much easier on Linux than it is
31-
on Windows. For instance, to return a string, you simply return a copy of it on
32-
the heap. Since only one memory allocator is used on Linux, the .NET runtime
33-
has no problem later freeing the buffer. Additionally, .NET presumes that the
34-
codepage "Ansi" on Linux is always UTF-8. So just marshal the string as
35-
`UnmanagedType.LPStr`.
36-
37-
### C# (Managed)
38-
39-
```c#
40-
[DllImport("libpsl-native", CharSet = CharSet.Ansi)]
41-
[return: MarshalAs(UnmanagedType.LPStr)]
42-
internal static extern string GetSomeString();
43-
```
44-
45-
### C (Native)
46-
47-
```c
48-
char *GetSomeString()
49-
{
50-
return strdup("some string");
51-
}
52-
```
53-
54-
The CoreFX team has an excellent guide for [UNIX Interop][].
55-
56-
[UNIX Interop]: https://github.com/dotnet/corefx/blob/master/Documentation/coding-guidelines/interop-guidelines.md#unix-shims
3+
The code under `powershell-native` is being migrated to [PowerShell-native](https://github.com/PowerShell/PowerShell-native) repository.
4+
Please make PRs to the new repository.
5+
Code under here will be removed once the move is complete.

‎src/powershell-native/README.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# powershell-native
2+
3+
The code under `powershell-native` is being migrated to [PowerShell-native](https://github.com/PowerShell/PowerShell-native) repository.
4+
Please make PRs to the new repository.
5+
Code under here will be removed once the move is complete.

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL