slang-users mailing list

[2021 Date Index] [2021 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

[slang-users] Slirp / slirp_map_struct() not working


Hi,
I have a problem – I cannot access C struct's members from SLang. Code:

typedef struct
{
    char *name;
    char *path;
    char *syntax;
} WindowEntry;


/* A function… */
WindowEntry *slang_api__wins(void)
{
    WindowEntry *en = g_new0(WindowEntry, 2);
    en->name = g_strdup("Hi!");
    en->path = g_strdup("Hi 2!");
    en->syntax = g_strdup("c program");
    return en;
}

Now running a function on wins_returned->path yields error:

"WindowEntry_Type does not permit structure access"

In slirprc, I have:

slirp_map_struct("WindowEntry*");

However it doesn't help. How to "export" struct to S-Lang?

The docs say:

"In the present implementation additional manual coding is required to
define the structure layout used by the SLang_push_cstruct() and
SLang_pop_cstruct() routines."

Which manual code?
-- 
Sebastian Gniazdowski

[2021 date index] [2021 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]