Re: RFE: support safely wrapping restricted FFM calls

2023-11-19 Thread Kasper Nielsen
Hi Rob, In that case maybe just have an interface users of your library must implement with all the relevant caller sensitive methods? And then require the user to specify an instance whenever they call into your library? If you need to set up some static data structures this would probably not be

Re: RFE: support safely wrapping restricted FFM calls

2023-11-18 Thread Rob Spoor
On 18/11/2023 06:46, Kasper Nielsen wrote: Hi Rob, Delegating caller sensitive methods can be tricky. Besides the obvious solutions with StackWalker and/or Lookup objects I've sometimes used an abstract class that must be extended by users of my library. This may be more trouble in your case th

Re: RFE: support safely wrapping restricted FFM calls

2023-11-17 Thread Kasper Nielsen
Hi Rob, Delegating caller sensitive methods can be tricky. Besides the obvious solutions with StackWalker and/or Lookup objects I've sometimes used an abstract class that must be extended by users of my library. This may be more trouble in your case than the other solutions though. In your situa

Re: RFE: support safely wrapping restricted FFM calls

2023-11-16 Thread Rob Spoor
On 16/11/2023 18:15, Maurizio Cimadamore wrote: On 16/11/2023 16:54, Rob Spoor wrote: Hi Maurizio, I don't think you understand what my module is doing. For instance, it's not specifying the downcall method handles themselves, it's just making it easy to define them. Maybe a small example wo

Re: RFE: support safely wrapping restricted FFM calls

2023-11-16 Thread Maurizio Cimadamore
On 16/11/2023 16:54, Rob Spoor wrote: Hi Maurizio, I don't think you understand what my module is doing. For instance, it's not specifying the downcall method handles themselves, it's just making it easy to define them. Maybe a small example would show what I'm doing. Consider the followi

Re: RFE: support safely wrapping restricted FFM calls

2023-11-16 Thread Rob Spoor
Hi Maurizio, I don't think you understand what my module is doing. For instance, it's not specifying the downcall method handles themselves, it's just making it easy to define them. Maybe a small example would show what I'm doing. Consider the following partial interface from JNA: public

Re: RFE: support safely wrapping restricted FFM calls

2023-11-16 Thread Alan Bateman
On 15/11/2023 17:13, Rob Spoor wrote: Hello all, I'm working on a module that makes working with FFM easier; think of something like JNA. For instance, it allows creating structures without having to manually manage var handles etc. My module uses restricted mehods like AddressLayout.withTar

Re: RFE: support safely wrapping restricted FFM calls

2023-11-15 Thread Maurizio Cimadamore
Hi Rob, honestly I think this all looks ok (as in: I don't think you need to do anything in particular). You are writing a library that will need to create some downcall method handles and dereference some pointers. You need unsafe access, so users of your library will need to pass your module

RFE: support safely wrapping restricted FFM calls

2023-11-15 Thread Rob Spoor
Hello all, I'm working on a module that makes working with FFM easier; think of something like JNA. For instance, it allows creating structures without having to manually manage var handles etc. My module uses restricted mehods like AddressLayout.withTargetLayout to support pointers. Those c