This is a Clipper example that was sent to us by an EVERLOCK customer.

//=========================================================
// Filename test.prg

Function Test()
   Local compstat := Everlock()

   if compstat == 0
      "Authorization is valid, program can run"
   else
      "Unauthorized copy, error occurred in EVCHK3"
      quit
   endif

   // compstat is actually sb.stat1 returned from EVCHK3.
   // if compstat is non-zero, the program should not run.

return nil

To compile this clipper module, use clipper test /n
To compile the c program, use bcc -c -ml filename.c (if using Borland C++)
To link the entire program, use blinker fi test,filename,EVCHK3 lib cl

That should do it.

Hope this helps.


Below are changes to check.c to make it Clipper callable.
/* CHECK.C *//* This is the 'C' EVCHK3.OBJ sample code */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "sb.h"
#include "Extend.api"   // Addition line being included

// Assign pointer to SB Structure in SB.H
SB sb;

void _retni(int);       // Prototype for return value to clipper

/* EVCHK3 Prototype */
short far pascal EVCHK3(SB far *);

CLIPPER Everlock()
{
   short comp_status;

   strncpy(sb.id, "AZSB", 4);    /* Signature Literal */
   sb.stat1 = 0x7240;            /* Initialize to invalid status code.  */
   sb.func = 1;                  /* Function 0, 1, or 2.  */
   strcpy(sb.source, "A:\PCHECK.EXE"); /* Path and Program to check */
   sb.pin = 1234567890;          /* Product ID Number */

   comp_status = EVCHK3(&sb);     /* Call the EVCHK3 function */

   if(comp_status == 0)
      _retni(sb.stat1);
   else
      _retni(comp_status);
}
