call to bip39_mnemonic_from_bytes in libwally-core returns NULL what am I doing wrong? it always returns with error -2... I included libwallycore to my project and my IDE tells me it it is available after I also did include &lt;wally_bib39.h&gt;

I tried mainting a wordlist myself but then I run into even more mistakes so I guess I am missusing the API. Ca anyone help out pls?

static void display_mnemonic_word_list(void){
    char **mnemonic_secret=NULL;
    //wordlist_init(bip39_wordlist)
    const unsigned char myArray[] = { 0x00, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22,  0x33 };
    int ret = bip39_mnemonic_from_bytes(NULL,myArray,32,mnemonic_secret);
    if (ret!=WALLY_OK){
        printf("mnemonic did not work. error: %d",ret);
    }
    printf("HSM: your should remember / write down the following words do recover your funds!");
    if (mnemonic_secret){
        int i = 0;
        while ( *mnemonic_secret )
            printf( "%d. %s", ++i, *mnemonic_secret++ );
    }
}
There are a few problems, you are passing mnemonic_secret incorrectly resulting in the API call getting a NULL pointer hence returning WALLY_EINVAL. Here is a corrected version, although note that your myArray is still the wrong size:

#include &lt;stdio.h&gt;
#include &lt;wally_bip39.h&gt;

int main()
{
    /* Note that this array is 34 elements long which seems incorrect, it should be 32 */
    const unsigned char myArray[] = { 0x00, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22, 0x11, 0x22,  0x33 };
    char *mnemonic_secret;

    int ret = bip39_mnemonic_from_bytes(0, myArray, 32, &amp;mnemonic_secret);
    if (ret != WALLY_OK) {
        printf("mnemonic did not work. error: %d",ret);
        return 1;
    }
    printf("HSM: your should remember / write down the following words do recover your funds!\n");
    printf("%s", mnemonic_secret);
    wally_free_string(mnemonic_secret);
    return 0;
}


You may get a faster response with wally question by asking on their github at https://github.com/elementsproject/libwally-core.