[Vala] About VAPI's instance position



Hi guys,


I 'm have updating the openssl.vapi file, and met a trouble about instance position. the OpenSSL api as 
follow:
-----------------------------------------------------------
#include <openssl/rsa.h&gt;


int RSA_public_encrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding);


int RSA_private_decrypt(int flen, const unsigned char *from, unsigned char *to, RSA *rsa, int padding);
-----------------------------------------------------------


translate to Vala vapi code as follow:
-----------------------------------------------------------
[Compact]
[CCode (lower_case_cprefix = "RSA_", cprefix = "RSA_", cheader_filename = "openssl/rsa.h", free_function = 
"RSA_free")]
public class RSA
{
&nbsp; &nbsp; public int generate_key_ex(int bits, BIGNUM e, BN_GENCB? cb = null);


&nbsp; &nbsp; [CCode (instance_pos = 2.1)]
&nbsp; &nbsp; public int public_encrypt(int flen, [CCode (array_length = false)] uint8[] from, [CCode 
(array_length = false)] uint8[] to, int padding);


&nbsp; &nbsp; [CCode (instance_pos = 2.1)]
&nbsp; &nbsp; public int private_decrypt(int flen, [CCode (array_length = false)] uint8[] from, [CCode 
(array_length = false)] uint8[] to, int padding);&nbsp;
}
-----------------------------------------------------------


if set the instance_pos as 3, the compiler will output errors:
error: too few arguments to function 'RSA_public_encrypt'


if set the instance_pos as 2.1, the code can compile and will crashed at function public_encrypt / 
private_decrypt,


I don't know how to set the instance_pos's value, could anybody give me some tips to fix this error?
thanks in advanced.


ZuHong Tao
2/22/2020


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]