Concatting Library files


I am very new to TrueBasic, just bought it yesterday. I have been looking at the DLL interfacing which allows the use of external DLLs. So far I have managed to export a simple MessageBox function which displays "HelloWorld!" when the DLL is executed from TrueBasic. When using FinalTouch (FTOUCH.EXE), how do I concat the library files generated into a single file? Is there a tool provided with the distribution?


Multiple libraries

You are correct about the way that Final touch works, i.e. it only processes one routine or function at a time and creates a library unit containing only one routine or function. The easiest way to include several of these individual libraries into a single library is as follows:
Let us assume you have created three libraries using final touch called Alib.trc, Blib.trc and Clib.trc
Now create a separate library (written in TrueBASIC) called "compound.tru", e.g.

MODULE compound
SUB initialize_all
LIBRARY "Alib.trc","Blib.trc","Clib.trc"

In your main program you must refer to the compound library, e.g.
LIBRARY "compound.tru"
CALL initialize_all

Initializing the libraries this way ensures that all the routines in all the libraries are immediately accessible to your main program.

The routine "initialize_all" can contain hundreds of "final touch" DLL files, but your main program only has to call a single routine.

Big John


A whole chapter in the manual describes the use and structure of library modules.
Basically a library module can consist of any number of subroutines arranged like paragraphs in a text file. Your main program must contain a line of typical code as follows:
This will make all the routines and functions in the library available to the calling program. Any number of library units can be called from the main program. Library units can also call other library units.
The library file can be plain source text (.TRU) or it may be compiled (.TRC).
The library file must begin with MODULE and an identifying name, and must end with END MODULE. Prior to the list of sub-routines and/or functions, the library file may also contain some intial code that will be executed only once when the library is first called. This is useful for setting the initial value of variables.
One of the most useful features of MODULES is the ability to use SHARE variables, i.e. variables that retain their value, even when the module is not being used.

Big John

Hi BigJohn Thanks for your

Hi BigJohn

Thanks for your response, I don't think I explained myself properly. The FinalTouch program provided with the Gold edition actually generates a single library per function exported from the DLL. So if I have 10 functions in my DLL, I have to run FTOUCH.EXE 10 times over for each function in the DLL and I get 10 Libraries generated. Thats why I was asking if it's possible to concat the 10 generated libraries into a single one?

Try running FTOUCH.EXE and you will see what I mean.