libtwitter-glib ã®ã½ã¼ã¹ã³ã¼ããèªãã§ãããC ã§ã«ãã»ã«åããã¹ãã¼ããªæ¹æ³ã¿ãããªã®ããã£ãã®ã§ã¡ã¢ãã¦ããã*1
ã¾ãããããã®æ¹ã«æ§é ä½ã宣è¨ããããå¤é¨ã«è¦ããæ§é ä½ (User) ã®ã¡ã³ãã¯å
é¨ã®ãã©ã¤ãã¼ããªæ§é ä½ (UserPrivate) ã®ãã¤ã³ã¿ã®ã¿ã«ãã¦ããã
typedef struct User_ User; typedef struct UserPrivate_ UserPrivate; struct User_ { UserPrivate* priv; }; int user_get_id (User* user); char* user_get_name(User* user);
ã½ã¼ã¹ãã¡ã¤ã«ã®æ¹ã§å é¨ã®ãã©ã¤ãã¼ããªæ§é ä½ã¨åã¡ã³ãã¸ã®ã¢ã¯ã»ããµãç¨æããã
struct UserPrivate_ { int id; char* name; }; int user_get_id(User* user) { return user->priv->id; } char* user_get_name(User* user) { return user->priv->name; }
ãã®ããã«ããã¨åã¡ã³ãã¸ã®ã¢ã¯ã»ã¹ã¯ã¢ã¯ã»ããµã使ã以å¤ã«æ¹æ³ããªããªããå½åè¦ç´ã決ãã¦ããã°ãèªåçæãç°¡åã«ã§ããããªæ°ãããã
ä»ã¾ã§ã¯ MPI ã® MPI_Info ã®ãããªããã·ã¥ãã¼ãã«é¢¨ãªã¤ã³ã¿ãã§ã¼ã¹ã§å®è£ ããæ¹æ³ããã¿ã ã¨æã£ã¦ãããã©ããã£ã¡ã®æ¹ãè¯ããã
*1:ãããããã glib/gobject ã§å®ç³ãªã®ãããããªããã©ã