Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how am i supposed to work strings and vars with multiple functions? #155

Open
TunifyBasic opened this issue Dec 22, 2024 · 0 comments
Open

Comments

@TunifyBasic
Copy link

!!	
!!	Uncaught ValueError
!!	
!!		 Pointer '0x5f3681880004' passed to 'type_of' has bad magic number, perhaps it wasn't allocated by Cello.
!!	
#include <stdio.h>
#include <stdlib.h>

#include "inc/Cello.h"

struct fast_s {
        var string;
        var number;
};

void initFast(struct fast_s *fast) {
        fast->string = alloc(String);
        construct(fast->string, "hello, world!");
        show(fast->string);
        fast->number = new(Int, $I(4));
        return;
}

int main(int argc, char *argp[]) {
        struct fast_s *fast = malloc(sizeof(struct fast_s));
        initFast(fast);
        show(fast->string);
        show(fast->number);
        free(fast);
        return 0;
}```

i  tried $S $(String new(String but same always fail so how this should be done?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant