advertisement
Login | Register   
  Include Code  Search Tips
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   TIP BANK
Browse DevX
Partners & Affiliates
advertisement
advertisement
advertisement
advertisement
 

Brew Extensions: How They Work and When to Use Them

Unlocking the power of Brew's extensions can be somewhat tedious at first. Once you know the ins and outs, you can bring their extensive horsepower to bear with ease and precision.  


advertisement
xtensions are tricky objects. They behave similarly to C++ classes except they're ruthlessly complicated to implement. They give Brew developers, usually limited to C code, a chance to stretch their legs into the wonderful world of objects and obfuscation. Extensions, when mastered, give nearly all the benefits of C++ style with a few drawbacks. In this article, I hope to do three things:
  1. I will bore you, at length, with an explanation of Brew's extension architecture.
  2. I will demonstrate how to create, use and destroy a custom Brew extension.
  3. I will explain how to take advantage of C++ code from within a C only extension.
I've written a very simple object that reverses strings for the purpose of demonstration. It's not a particularly useful or complicated object, but it should serve to demonstrate the topic at hand. Hopefully, you'll finish with a strong understanding of Brew's extensions and the experience to put that architecture to work in your own projects.

Extensions in Context
Before diving into the nuts and bolts, let's quickly discuss how Brew extensions function from a somewhat academic standpoint. If you're reading this article for more practical purposes, feel free to skip down to the next section.


It's quick, easy and you get access to all the articles on DevX.
This registration/login is to allow you to read articles on devx.com.
Already a member?



advertisement