Wrapper for PAM
evilrat
evilrat666 at gmail.com
Mon Oct 7 11:31:44 UTC 2024
On Monday, 7 October 2024 at 08:23:08 UTC, Alexander Zhirov wrote:
> I tried to build a class with a private function
> `conversation_func` to call it inside the public authentication
> function. When compiling I get this message:
> ```
> source/login/auth.d(87,46): Deprecation: casting from extern
> (C) int delegate(int num_msg, const(pam_message**) msg,
> pam_response** resp, void* appdata_ptr) to extern (C) int
> function(int, const(pam_message**), pam_response**, void*)* is
> deprecated
> ```
> And when I start up, at the moment of calling the
> authentication function, I get `Segmentation fault`.
>
> Is the function identified differently in the class? How can
> this be fixed?
Of course it segfaults, you are trying to give delegate
pretending it is to be a standalone function.
For example you can fix it by using a trampoline - Make a global
class instance somewhere, make conversation_func static (if you
absolutely want it to be in class) and then in that function use
instance.actual_conversation_func, that will do actual work.
Maybe other solutions exists that is not variation of this method
by I can't come up with anything else.
More information about the Digitalmars-d-learn
mailing list