Note that there are some explanatory texts on larger screens.

plurals
  1. POImplementing a header in Objective C
    primarykey
    data
    text
    <p>I'm completely new to <code>Objective C</code> and I'm trying to use it to wrap a <code>C-library</code>. I have a <code>main.m</code> <code>wrap.m</code> and <code>wrap.h</code> files. From what I gather in the header file I included <code>@interface</code> and in the source file I will include <code>@implementation</code> However I'm not really understanding what to include in each of them. Right now my main file is: </p> <pre><code>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); } } int main(int argc, const char * argv[]) { @autoreleasepool { 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"); } return 0; } </code></pre> <p>So far what I'm getting in my <code>wrap.h</code> file is: </p> <pre><code>typedef struct{ int *a; int *ext; }archive; @interface main : NSObject @property int flags; @property int r; </code></pre> <p>I don't know if that is close to what I need to do, and I'm getting errors on my <code>ARCHIVE_EXTRACT</code> saying they are undeclared identifiers which I assume also have to go into my <code>wrap.h</code> file but I'm not sure how to do that. Any help at all would be appreciated! </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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