Developing Yed objects - Hiding functions

At the very end, a method is only a normal function; then, it can be directly invoked without passing to object interface. For obscuring Yed object functions and permit their invocation only through the object interface, we can use the C language opportunity to hide a function to external environment, through the use of keyword 'static'.
This is the macro you can use ( in red ), in header file yedstd.h:


#ifndef YEDSTD
#define YEDSTD


#define PUBLIC
#define PRIVATE(x) __P##x

#define PRIVATE_FUNCTION static


#define New(x) (x *)_##x()
#define Delete(x,a) _D##x(a)



Now you can declare as PRIVATE_FUNCTION, that is 'static', methods and other functions needed in object implementation, in this way:

#include "yedstd.h"

typedef struct{                     
PUBLIC char my_attr;            
PUBLIC int (*My_Func)(void *);    
char PRIVATE(protected);           
} Myclass;   

PRIVATE_FUNCTION int My_Func(void *);

Object implementation becomes finally:

#include "yedstd.h"
#include "myclass.h"

MyClass * _MyClass(void) {
MyClass *this=malloc(sizeof(MyClass));
if(this!=NULL) {
return this;

void _DMyClass(void *pvT) {

PRIVATE_FUNCTION int My_Func(void *pVWork) {
MyClass *this=pvWork;        // 'THIS' POINTER OF THE INSTANCE!!!
printf("The protected member value is [%d]\n", this->PRIVATE(protected));
return 0;

My_Func is not direcly accessible through external applications linking MyClass object, because it's hidden: if you try, C compiler will say you that there is an 'undefined reference to 'My_Func' in your application. Try and see!

Now you have all instruments needed to develope Yed objects, or C objects that incapsulate and hide their data and implementations. If you are interested in this scenario, you can find Yed objects already developed and released under the terms of Open Source licence in the site