PKCS#11 API

From: Carla Schaffner (schafcar_at_zhwin.ch)
Date: 09/17/03


Date: Wed, 17 Sep 2003 08:06:30 +0200

Hi!

To test cryptoki / access to smart card we have the code below.
Does anyone know why the function C_Initialize from the cryptoki header file
is not accessible?

Thanks.
Carla

----------- Code ---------------------------
#include <stdio.h>
#include <opensc/cryptoki.h>

void main (void) {
        
        CK_RV r;
        CK_INFO info;
        r = C_Initialize(NULL_PTR);
        if (r != CKR_OK) {
                fprintf(stderr, "C_Initialize() failed -code 0x%x\n", r);
                exit(1);
        }
        fprintf(stderr, "C_Initialize() succeeded!\n");
        C_Finalize(NULL_PTR);
}
----------- Error---------------------
ReadCert.c: In function `main':
/tmp/ccvfY2Ep.o(.text+0x16): In function `main':
: undefined reference to `C_Initialize'
/tmp/ccvfY2Ep.o(.text+0x3c): In function `main':
: undefined reference to `C_Finalize'
collect2: ld returned 1 exit status