Code Monkey home page Code Monkey logo

scoop's Introduction

I think the time has come to begin leaving GitHub behind. I'm more active on Codeberg, but I still check GitHub notifications.

My personal website has more on my projects and interests, and also points to some further places where you'll find me.

scoop's People

Contributors

joelkp avatar

Stargazers

 avatar

Watchers

 avatar

scoop's Issues

How to access member methods?

Here is what I have done:

#ifndef MY_CLASS_H
#define MY_CLASS_H

#include <scoop/BEGIN.h>
#include <scoop/Object.h>

#define MyClass_ \
    int x; \
    int y; \
    int z; 
#define MyClass__ \
    void (*mul)(SCO_TYPE* o,int m);

SCOclass(MyClass);
SCOclassctor(MyClass,sco_MyClass,(SCO_TYPE*o,int sx,int sy,int sz));

#define sco_MyClass_mul(o) \
    (o)->classdesc->vtab.mul(o,m)
void sco_MyClass_mul_(SCO_TYPE *o,int m);
#include <scoop/END.h>

#endif

And the C File:

#define SCO_MODULE MyClass

#include "MyClass.h"
#include <stdio.h>

void sco_MyClass_mul_(SCO_TYPE *o,int m) {
    printf(" %d * %d * %d = %d", o->x,o->y,o->z, (o->x * o->y * o->z * m) );
}
static void MyClass_vtinit(MyClass_CD *o)
{
    MyClass_VT *vt = &o->vtab;
    vt->mul = sco_MyClass_mul_;
}
SCO_CLASSDEF(MyClass, scoNull, 0, MyClass_vtinit);

SCO_CLASSCTOR(MyClass, sco_MyClass, (MyClass *o,int sx,int sy,int sz), (o,sx,sy,sz), o)
{
    o->x = sx;
    o->y = sy;
    o->z = sz;
    return 1;
}

My Question is: How can I easily call mul? Do I have to call it direct with sco_MyClass_mul(mc,30) ?

Also, it was working a minute ago, and now I get: Object-test.c:(.text.startup+0x53): undefined reference tosco_MyClass_new'`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.