Skip to content

D4yvid/bind

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bind - A equivalent of the JavaScript's bind but for C.

Why?

The question is, why not?

Is this ready?

No. Really, this is really unstable now.

Why AArch64 first?

Because i do not have my computer with me, only my phone, and it's 64-bit arm.

Usage:

The usage is really simple, there's only two functions:

bind() and unbind()

Example:

#include <stdio.h>  // `puts`, `fprintf`
#include <bind.h>   // `bind`, `unbind`

int main(void)
{
    int (*put)(void) = (typeof(put)) bind(&puts, "Hello, world!");

    // The `put` function is the `puts` function with it's first argument
    // bound to the "Hello, world!" pointer

    put(); // puts("Hello, world!")

    unbind((void *) put);

    return 0;
}

About

JavaScript's `bind` equivalent in C

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published