SkillAgentSearch skills...

Closure2fp

An example to illustrate how libffi cast a closure to a pointer to function.

Install / Use

/learn @wtdcode/Closure2fp
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

closure2fp

An example to illustrate how libffi cast a closure to a pointer to function. Note that this only works on Linux x86_64.

Blog post link:

Sources

  • closure.c closure.h: The closure lib to cast a closure to a raw function pointer.
  • lib.c lib.h: The lib that provides API to register callback.
  • main.c: The example that uses lib.h well-designed callback API.
  • main.cpp: The example that uses lib.c well-designed callback API with a cpp wrapper.
  • main_bad.c: The example that uses lib.h bad-designed callback API.
  • main_bad.cpp: The example that uses lib.c bad-designed callback API with a cpp wrapper.
View on GitHub
GitHub Stars16
CategoryDevelopment
Updated4mo ago
Forks0

Languages

C

Security Score

72/100

Audited on Nov 13, 2025

No findings