gendllib

Introduction

gendllib is a program which is used when building DLL's. I converts a file with details of the routines which have to be accessable and builds a library file and a file which is necessary to do the linking.

Contrary to conv, this program builds a library in which not all the routines are always linked. This is useful when you are building a library with a lot of routines, which are not all used (like syslib and PROforma). For smaller libraries, conv build better libraries (e.g. for ProWesS).

To make sure that the linker and DLL Manager can properly work with these files, an init function has to be called. This functions does not do anything, except give some hints by making sure that the DLL linkage structures are built properly by the linker. The startup files automatically include this routines for syslib.

This program uses some of the c68 compiler stages to generate its output. It is assumed that c68 can be found on the program default (cfr. DEVProgramGet).

Usage

gendllib filename
filename
The name of the file (excluding _dll extension) which has to be treated. The file will be searched on the data default device (cfr DEVDataGet). The output files will be filename_a (for the library file) and filename_s for the file which contains the table of routines to link. Some auxiliary tmp_s and tmp_o files are also built (these can safely be removed).

File format

The file format is line oriented. The first four lines have a special meaning.

The first line contains the name of the function which has to be included in the link to make sure that the DLL linkage structure is built properly. If you want this function to be visible, the name has to start with an underscore (as this is prepended to all names by c68).

The second line contains the name of the thing extension which will link this library (maximum four letters). The actual name of the thing should be given on the next line.

The fourth line contains the version identifier for the library linkage. This identifier only has to be modified when routines are deleted, replaced or removed. When new routines are added, the version can stay the same.

All the following lines contain the names of routines which have to be linked. You just have to give the name of the routine. (The starting underscore is added by gendllib if the name does not start with a dot). It is assumed that all names given are functions names. If one of the names is a data, then an at symbol(@) should be appended. You can leave empty spaces which do not contain a function or data by starting the line with a percentage symbol (%), or by leaving the line empty. If the line is later used, the library will still be compatible (and version numbers can be retained).

For example, the syslib DLL linkage file (part of it) looks as follows :

_InitSysLib
LIBR
syslib
v01
_ctype@
_cupper@
_clower@
alloca
.Xdfutodf
.Xasdfmul
ROUTCall
ROUTCallList

And it is used in the makefile using the following lines :

libsms_a dllsms_o : sms_dll
    gendllib sms
    cc -c dllsms_s
    rm tmp_s tmp_o

win1_c68_lib_libsms_a : libsms_a
    cp libsms_a win1_c68_lib_libsms_a

Linkage Block Format

The linkage block which is built by gendllib has the following format :

typedef struct
{
    char identifier[8];   /* e.g. "<>" */
    void *usercode;       /* base address for usercode
    char extension[4];    /* extension name, cfr line 2 */
    short namelen;        /* length of thing name */
    char thingname[];     /* thing name (not terminated) */
    char space;           /* space character */
    char version[];       /* version string (not terminated) */
    short linkages[];     /* list of linkage keywords */
} DLLEntry;

The linkage keywords are built as follows :
    MS  2 bits : format, %01 for JMP.L address, %10 for just the address
    LS 14 bits : code for address which has to be linked
    The list of linkage keywords is NULL terminated.

PROGS, Professional & Graphical Software
last edited February 18, 1996