Menu

create

hooks (5)
Majenko Technologies

Format: void * create(void)

This is called when the device is created by the device configuration directive. The function should allocate a structure for data storage for this instance of the device. A pointer (cast to void * ) to this structure should be returned.

Example:

struct context {
    unsigned int foo;
    float bar;
    char lala[30];
};

void *create(void)
{
    struct context *ctx;
    ctx = malloc(sizeof(struct context));
    return (void *)ctx;
}

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.