Code Monkey home page Code Monkey logo

Comments (10)

alexbw avatar alexbw commented on August 30, 2024

Hey Tonio,
Try making the suggested changes, and then removing the explicit setInputBlock: and setOutputBlock: methods (which perform an explicit Block_copy), and let me know what happens.

Best,
Alex

On Apr 3, 2012, at 1:06 PM, Tonio Loewald wrote:

When I tried to incorporate novocaine into my own project I get a lot of tricky warnings and link errors. It's kind of neat how you've integrated C++ and Obj-C++ into a minimal number of source files, but I wonder if you're confusing the compiler/linker

  1. I get warnings which I frankly do not understand surrounding the blocks. ("Capturing 'self' ...")

  2. Probably related: I get warnings about these declarations:

@property (nonatomic, retain) OutputBlock outputBlock; @property (nonatomic, retain) InputBlock inputBlock;

It wants me to use copy instead of retain.

I assume that my project settings are wrong in some subtle way (I've tried to match them to yours) — but I want to understand what's going on since I need to integrate this stuff into a much larger project.


Reply to this email directly or view it on GitHub:
#3

from novocaine.

tonioloewald avatar tonioloewald commented on August 30, 2024

Thank you for your reply!

I made the changes and now I only get one warning:

Capturing 'self' strongly in this block is likely to lead to a retain cycle

As far as I can tell this is OK -- we're handing the block over once and we want it to be retained for the lifetime of the containing object... I tried experimentally explicitly releasing the blocks on release but that did not make the compiler happy...

I'm also getting mysterious link errors (again I've spent quite a while trying to chase them down) -- maybe you'll be able to tell instantly:

Undefined symbols for architecture i386:
"RingBuffer::RingBuffer(long long, long long)", referenced from:
-[ACViewController viewWillAppear:] in ACViewController.o
"RingBuffer::AddNewInterleavedFloatData(float const*, long long, long long)", referenced from:
___35-[ACViewController viewWillAppear:]_block_invoke_0 in ACViewController.o
"OBJC_CLASS$_Novocaine", referenced from:
objc-class-ref in ACViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

from novocaine.

alexbw avatar alexbw commented on August 30, 2024

Is your ACViewController named ACViewController.mm?
It must be an Objective-C++ file to work.

On Apr 4, 2012, at 10:57 AM, Tonio Loewald wrote:

Thank you for your reply!

I made the changes and now I only get one warning:

Capturing 'self' strongly in this block is likely to lead to a retain cycle

As far as I can tell this is OK -- we're handing the block over once and we want it to be retained for the lifetime of the containing object... I tried experimentally explicitly releasing the blocks on release but that did not make the compiler happy...

I'm also getting mysterious link errors (again I've spent quite a while trying to chase them down) -- maybe you'll be able to tell instantly:

Undefined symbols for architecture i386:
"RingBuffer::RingBuffer(long long, long long)", referenced from:
-[ACViewController viewWillAppear:] in ACViewController.o
"RingBuffer::AddNewInterleavedFloatData(float const*, long long, long long)", referenced from:
___35-[ACViewController viewWillAppear:]_block_invoke_0 in ACViewController.o
"OBJC_CLASS$_Novocaine", referenced from:
objc-class-ref in ACViewController.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)


Reply to this email directly or view it on GitHub:
#3 (comment)

from novocaine.

tonioloewald avatar tonioloewald commented on August 30, 2024

Yes I banged my head on that particular wall earlier :-)

I've got it compiling and running.

  1. For some reason I had to explicitly add it to the compile list (I figured out it wasn't compiling the Novocaine files at all...)
  2. I explicitly disabled ARC for the Novocaine files (otherwise hordes of errors)
  3. I'm still getting the "Capturing self strongly" bug...;

It all seems to be working (I'm chasing down some memory management stuff caused by mixing ARC and non-ARC code).

from novocaine.

alexbw avatar alexbw commented on August 30, 2024

Ohhhh, yeah Novocaine isn't built to work with ARC at all. If you do get it working, please make a branch of Novocaine, and point me to it. ARC is something I'd definitely like to support in the future.

Best,
Alex

On Apr 4, 2012, at 11:43 AM, Tonio Loewald wrote:

Yes I banged my head on that particular wall earlier :-)

I've got it compiling and running.

  1. For some reason I had to explicitly add it to the compile list (I figured out it wasn't compiling the Novocaine files at all...)
  2. I explicitly disabled ARC for the Novocaine files (otherwise hordes of errors)
  3. I'm still getting the "Capturing self strongly" bug...;

It all seems to be working (I'm chasing down some memory management stuff caused by mixing ARC and non-ARC code).


Reply to this email directly or view it on GitHub:
#3 (comment)

from novocaine.

alexbw avatar alexbw commented on August 30, 2024

Okay, I'm going to open a separate issue about ARC compatibility, and close this one, if that's alright with you.

from novocaine.

tonioloewald avatar tonioloewald commented on August 30, 2024

It's all good now. One thing I found a bit confusing is that the execution context for the input and output blocks doesn't allow you deal with memory allocation (the code I'm writing uses ARC, I've blocked ARC for the Novocaine files, and the blocks are this no-man's land where I can't seem to use manual OR automatic memory management.

My solution was to refactor anything requiring memory allocation out to methods executing in a normal context. No problems at all now except the "Capturing 'self'..." warning.

from novocaine.

alexbw avatar alexbw commented on August 30, 2024

Okay, so just to be clear — Novocaine will work without errors when using ARC, you just have to disable it explicitly in those files?

from novocaine.

coryalder avatar coryalder commented on August 30, 2024

p.s. for the record: I'm using Novocaine under ARC, with AudioFileReader.mm, AudioFileWriter.m, RingBuffer.mm and Novocaine.m all flagged -fno-objc-arc. No problems so far.

from novocaine.

casbreuk avatar casbreuk commented on August 30, 2024

I found that if I put self. in front of a member variable inside a block that had the arc-retain warning, that warning would go away.

from novocaine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.