Stream: beginners

Topic: glue exported functions


view this post on Zulip Oskar Hahn (May 30 2024 at 04:59):

I am currently trying to write the glue spec for go, using the roc-platform-template from @Luke Boswell

As a first step, I am trying to generate the .h file. The result should look like this:

#include "roc_std.h"

struct ResultVoidI32 {
    union {long int exit_code;} payload;
    unsigned char disciminant;
};

struct ResultVoidStr {
    union {struct RocStr str;} payload;
    unsigned char disciminant;
};

void roc__mainForHost_1_exposed_generic(void* captures);
size_t roc__mainForHost_1_exposed_size();
void roc__mainForHost_0_caller(char* flags, void* closure_data, struct ResultVoidI32 *result);

My problem is, that the glue command does not include the functions to the list of types, when calling makeGlue in the spec. roc__mainForHost_0_caller is included, but not roc__mainForHost_1_exposed_generic and roc__mainForHost_1_exposed_size.

Is there some way to generate this function definitions?

view this post on Zulip Luke Boswell (May 30 2024 at 05:00):

@Folkert de Vries may be best placed to answer this

view this post on Zulip Oskar Hahn (Jun 05 2024 at 09:41):

I tried looking throw the source code from roc, but I can not find the place, where the list of types is collected.

I think, this happens here, here and finally here

But I am not able, to understand this load function. Could someone give me a hint, for what reason the exported functions could be missing?


Last updated: Jul 05 2025 at 12:14 UTC