Introducing the “Welcome to Xojo” Bundle!

New to Xojo and looking for guidance? We've put together a terrific bundle to welcome you! Xojo Bundle

This bundle includes six back issues of the magazine -- all of year 21 in printed book and digital formats -- plus a one-year subscription (beginning with 22.1) so you'll be learning all about Xojo for the next year. It's the perfect way to get started programming with Xojo. And you save as much as $35 over the non-bundle price!

This offer is only available for a limited time as supplies are limited, so hurry today and order this special bundle before the offer goes away!

Article Preview

Buy Now

Issue 4.3


Pictures and Dynamic Libraries: A Poor Man's Plugin, Part II

Issue: 4.3 (January/February 2006)
Author: Didier Barbas
Author Bio: Didier has been a dilettante programmer and linguist for more than 20 years. Unusual for a Frenchman, he speaks 11 languages, including Korean and PowerPC machine-language.
Article Description: No description available.
Article Length (in bytes): 7,524
Starting Page Number: 42
Article Number: 4320
Resource File(s):

Download Icon 4320.zip Updated: 2006-01-16 12:48:21

Related Web Link(s):


Excerpt of article text...

In my last column we saw the makings of a dynamic library and an RB class that could replace/stand in for the missing Picture class in console applications. Rather than bore you with more detailed accounts of how fPic's innards were put together, let's wander around and look at other pieces of the puzzle: ancillary tools used, and sometimes written, to help build a dylib/RB class pair. This should give you enough information to build your own, and possibly use such dylibs in other languages.

As I said in the previous column, building a dylib is best done with XCode. It does allow and/or require some tweaking, like setting up the necessary includes, the optimization level, or the instruction scheduling (for G4 or G5 processors). However, you might want more, like automatic packaging of the end-product -- things that can be easily automated and called from XCode as post-flight scripts. Also, while coding the RB end of the dylib, some repetitive tasks can be made easier with a dash of RB. Point in case: writing Declares. fPic has a lot of functions and writing the RB methods that matched these proved to be tedious, as every method required me to convert one or more C function calls into a Declare. As there are currently around 50 functions, you can imagine how boring it would become. So I wrote a small app that did the conversion for me. Fortunately, fPic's C code mainly uses void, int [*] and char [*], so writing a helper application that translated a C function declaration into an RB Declare was easy enough. This saved me a lot of typing. Let's see how it's done.

Converting C method declarations into Declares

...End of Excerpt. Please purchase the magazine to read the full article.