<div dir="ltr">Got it.<div><br></div><div>Thank you.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Feb 11, 2016 at 5:19 PM, Dmitri Gribenko <span dir="ltr"><<a href="mailto:gribozavr@gmail.com" target="_blank">gribozavr@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Thu, Feb 11, 2016 at 12:13 AM, Sergey Kuratov <<a href="mailto:ksubox.swift@gmail.com">ksubox.swift@gmail.com</a>> wrote:<br>
>>> Can I define similar for my Swift classes ?<br>
><br>
>>No. What would be your use case?<br>
><br>
> I also could have my Swift object with several members, but when send to<br>
> native part would like to send address exactly one of members.<br>
> Something like this:<br>
><br>
> // Swift part<br>
><br>
> class ABlock {<br>
><br>
> var channels = 2<br>
><br>
> var samplerate = 44100<br>
><br>
> var buffer : UnsafeMutablePointer<Int16><br>
><br>
> init() {<br>
><br>
> buffer = UnsafeMutablePointer<Int16>.alloc(2048)<br>
><br>
> }<br>
><br>
> deinit {<br>
><br>
> buffer.dealloc(2048)<br>
><br>
> }<br>
><br>
> }<br>
><br>
><br>
> var block = ABlock<br>
> generate(block) <- here I would like to send address of ABlock.buffer to<br>
> native part<br>
><br>
> // C part<br>
> void generate(int16_t *buf) {<br>
> ...<br>
> }<br>
<br>
</span>I'd recommend to write a Swift wrapper for your C code that accepts<br>
the class instance, and calls the generate() function with appropriate<br>
arguments.<br>
<div class="HOEnZb"><div class="h5"><br>
Dmitri<br>
<br>
--<br>
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if<br>
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <<a href="mailto:gribozavr@gmail.com">gribozavr@gmail.com</a>>*/<br>
</div></div></blockquote></div><br></div>