+#ifdef __BLOCKS__
+int
+atexit_b(void (^block)(void))
+{
+ struct atexit_fn fn;
+ struct dl_info info;
+ int error;
+
+ fn.fn_type = ATEXIT_FN_BLK;
+ fn.fn_ptr.block = Block_copy(block);
+ fn.fn_arg = NULL;
+#if defined(__DYNAMIC__)
+ if ( dladdr(block, &info) )
+ fn.fn_dso = info.dli_fbase;
+ else
+ fn.fn_dso = NULL;
+#else /* ! defined(__DYNAMIC__) */
+ fn.fn_dso = NULL;
+#endif /* defined(__DYNAMIC__) */
+
+ error = atexit_register(&fn);
+ return (error);
+}
+#endif /* __BLOCKS__ */
+