Creation of a library with WATCOM C/C++ für DOS:
The LCK disk provides "DOSWAT.MAK" for the creation of a .plb file.
Working with the Watcom C version 10.0a I use the following batchfile to create a library.
As example to create curdrive.plb:
REM ----------- curdrive.BAT --------------
IF EXIST curdrive.lnk DEL curdrive.lnk
IF EXIST curdrive.obj DEL curdrive.obj
IF EXIST curdrive.plb DEL curdrive.plb
IF EXIST curdrive.sym DEL curdrive.sym
IF EXIST curdrive.wat DEL curdrive.wat
IF EXIST curdrive.err DEL curdrive.err
WMAKE /f doswat.mak PLBNAME=curdrive MODEL=l
REM ----------- curdrive.BAT --------------
/* Sourcecode: curdrive.c */
/* Function --> CURDRIVE.C */
/* First Block ( SETUPAREA ) : Declaration- and include part: */
#include <dos.h> /* DOS-Declarationpart (Registerdefinitions)*/
#include <pro_ext.h> /* FoxPro Headerfile (Declaration part) */
/* ..in the second block you put the function itself : */
void FAR _cdrive(ParamBlk FAR *parm) /* parm = FAR-Pointer at ParamBlk */
{
union _REGS r ; /* r is a REGISTER-TYPE */
unsigned int current_drive ; /* current_drive is type INT */
r.h.ah = 25 ; /* fill AH-Register with 25d = 19h, h=BYTE-Reg*/
_int86(0x21,&r,&r) ; /* Call Interrupt */
current_drive = r.h.al ; /* Get the LOW-Value
aus AX-Register */
_RetInt(current_drive + 65,1); /* Return the value + 65 [ 65 = A] */
}
/* ..in the third block you'll find the arrayInfo-structure, that contains the calling names and internal names for every function and their parameters and parameters types. */
/* FoxInfo --> functionname FOX, functionname C, Parameter, "types,,," */
FoxInfo myFoxInfo[ ] =
{
{"CDRIVE", (FPFI) _cdrive, 0, ""},
};
/* FPFI is a 32-Bit-pointer to a function */
/* ..in the forth block you'll find a structuredefinition, with pointers to that info-structure of this library. */
FoxTable _FoxTable =
{
(FoxTable FAR *)0, sizeof(myFoxInfo) / sizeof(FoxInfo), myFoxInfo
};
/* End of file */
/* usage in foxpro: ? asc(curdrive()) */
Rob.