Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If you are actually interested in an objectivec solution, follow Michael Dautermann's instructions to start a new Command Line project but instead of Type C use the Foundation option. This will give you a working main (just a regular c function). Then select new->objective c class to create your wrap.h/wrap.m. In the wrap.h you will pretty much exclusively be declaring your own objectivec public wrapper methods. In the wrap.m, you'll be importing what you want to wrap, and defining your wrapper functions.</p> <pre><code>// // main.m // #import &lt;Foundation/Foundation.h&gt; #import "wrap.h" int main(int argc, const char * argv[]) { @autoreleasepool { [wrap wrappedStuff]; } return 0; } // // wrap.h // ---------- #import &lt;Foundation/Foundation.h&gt; @interface wrap : NSObject + (void)wrappedStuff; @end // // wrap.m // #import "wrap.h" #include "WhatImWrapping.h" @implementation wrap int copy_data(struct archive *ar, struct archive *aw) { for (;;) { const void *buff; size_t size; off_t offset; int r = archive_read_data_block(ar, &amp;buff, &amp;size, &amp;offset); if (r == ARCHIVE_EOF) return (ARCHIVE_OK); archive_write_data_block(aw, buff, size, offset); } } + (void)wrappedStuff { struct archive *a; struct archive *ext; struct archive_entry *entry; int flags; int r; /* Select which attributes we want to restore. */ flags = ARCHIVE_EXTRACT_TIME; flags |= ARCHIVE_EXTRACT_PERM; flags |= ARCHIVE_EXTRACT_ACL; flags |= ARCHIVE_EXTRACT_FFLAGS; a = archive_read_new(); archive_read_support_format_all(a); archive_read_support_compression_all(a); ext = archive_write_disk_new(); archive_write_disk_set_options(ext, flags); archive_write_disk_set_standard_lookup(ext); r = archive_read_open_filename(a, argv[1], 10240); for (;;) { r = archive_read_next_header(a, &amp;entry); if (r == ARCHIVE_EOF) break; r = archive_write_header(ext, entry); if (archive_entry_size(entry) &gt; 0) { copy_data(a, ext); } archive_write_finish_entry(ext); } archive_read_close(a); archive_read_free(a); archive_write_close(ext); archive_write_free(ext); NSLog(@"No Issues"); } @end </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload