-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Additional intrinsics for the NativePtr module #200
Comments
I'll add two functions to this list: [<Unverifiable>]
[<CompiledName("OfIlSigPtrInlined")>]
/// <summary>Returns a typed native pointer for an IL (Intermediate Language) signature pointer.</summary>
///
/// <param name="address">The IL signature pointer.</param>
///
/// <returns>A typed pointer.</returns>
val inline ofIlSigPtr : address: ilsigptr<'T> -> nativeptr<'T>
[<Unverifiable>]
[<CompiledName("ToIlSigPtrInlined")>]
/// <summary>Returns an IL (Intermediate Language) signature pointer for a given typed pointer.</summary>
///
/// <param name="address">The pointer address.</param>
///
/// <returns>An IL signature pointer.</returns>
val inline toIlSigPtr : address: nativeptr<'T> -> ilsigptr<'T> These two functions are also important because of interoperability with C#. C# pointers are CIL signature pointers, but the only way to specify them in F# currently is through |
Surprisingly CIL pointers do not interfere with piping. This would make exposing correct pointer signatures to C# more convenient. |
We basically marked this as approved for F# 4.0 and an implementation was started but not integrated I'll mark it as approved now. |
The .NET Runtime has no problem supporting conversion from For consistency, F# should add |
The problem is that this is very, very unsafe, and the right way is to pin. I don't think we should allow managed pointer --> native pointer in FSharp.Core, especially if underlying .NET Core methods are available anyway |
This has been completed (will be in F# 6.0) |
It may be a year later now, but I totally missed this in the "What's new" series a while ago, or maybe it was glanced over. Either way, I used to have a lot of pain getting my pointers together. This reminds me of the |
RFC: https://github.com/fsharp/fslang-design/blob/main/preview/FS-1109-Additional-intrinsics-for-the-NativePtr-module.md
Additional intrinsics for the NativePtr module [5670328]
Submitted by Jack Pappas on 3/23/2014 12:00:00 AM
10 votes on UserVoice prior to migration
When interoperating with native code, it would be handy if the NativePtr module included some additional "intrinsic" functions for taking advantage of low-level IL instructions; specifically, I'd like to be able to use 'cpblk', 'initblk', 'initobj', and 'copyobj'.
It would also be nice to have an easy way of checking for null pointer values.
Example implementation of these functions:
Response
** by fslang-admin on 11/8/2014 12:00:00 AM **
I’m marking this as “approved” for F# 4.0+.
A pull request for this feature has been submitted here:
https://visualfsharp.codeplex.com/SourceControl/network/forks/jackpappas/fsharpcontrib/contribution/7134
Thanks
Don, F# Language Design
Original UserVoice Submission
Archived Uservoice Comments
The text was updated successfully, but these errors were encountered: