Article Preview
Buy Now
COLUMN
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):
4320.zip Updated: 2006-01-16 12:48:21
Related Web Link(s):
http://ljug.com/table.php
http://sungnyemun.org/downloads/fPicTrial.tgz
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 [*]
andchar [*]
, 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.