On Oct 7, 2012, at 1:00 AM, koko <k...@highrolls.net> wrote: > I want to make a static cocoa library that is an NSTableView and allots data > is contained in the library. > I want images in the rows of the table. > Where would one get these images as their is no bundle where that can be > stored? > Or the question is where are resources for a static coco library stored?
All suggestions here are reduced to an external file (bundle) usage. Just for a case, if you really wish to store any data (non-executable code, like images, etc.) within the executable (regardless of the type: the main project, a static library, a dynamic library) there is a way to do it. But you'll need to know how to use assembler in the Cocoa project. If you know it, this way is for you. I used it in my Windows project, but never in Cocoa. AFAIK, you need to create a .s file and add it to your Xcode sources. Then Xcode will know what to do with this file. And you need to write something like this within the .s file: .text .globl _MyFunc pushl %ebx call L1 jmp L2 .align 1 .byte 0x0,0x1,0x2,0x3,0x4 .byte 0x5,0x6,0x7,0x8,0x9 L1: popl %eax movl eax, ebx pushl %eax ret L2: addl 5, %ebx movl %ebx,%eax popl %ebx ret As a result, you'll have the address of the embedded information in the eax register. I.e. you just need to create the function declaration like this one: (void *) myFunc(void); and call it. Hope this code is close to correct one, as I never dealt with Mac OS assembler. And please take it into account, that "5", mentioned in the code above, means the size of the "jmp L2" instruction, which is five in 32-bit assembler, but it will take nine bytes in the 64-bit one. And of course, I'm talking only about x86/64 assembler. Don't know anything about PowerPC one. The only what is left out is how to fill out the ".byte" with a useful information. Personally I used a specially written simple utility, transcoding any binary file into the fixed length lines of ".byte " hex codes. You can use decimal or octal codes too. as far as the assembler allows it. HTH! _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com