# Kann nicht C Function finden

**URL:** <https://www.pg-forum.de/t/kann-nicht-c-function-finden/8980>\
**Category:** Prozedurale Sprachen\
**Created:** [7. Oktober 2015 um 11:13 UTC](https://www.pg-forum.de/t/kann-nicht-c-function-finden/8980 "2015-10-07T11:13:34Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![matke](https://www.pg-forum.de/letter_avatar_proxy/v4/letter/m/48db29/32.png) [@matke](https://www.pg-forum.de/u/matke)\
**Post date:** [7. Oktober 2015 um 11:13 UTC](https://www.pg-forum.de/t/kann-nicht-c-function-finden/8980/1 "2015-10-07T11:13:34Z")

</div>

Hallo Leute,  
ich habe Problem mit C Stored Procedure.  
  
  
Das ist ein Beispiel in C, hier gibt es 2 Funktionen “isCardValid” und “getSecureKeys”

```nohighlight
#include <stdio.h>
#include <assert.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>

#include <openssl/des.h>
#include <openssl/rsa.h>
#include <openssl/dsa.h>
#include <openssl/hmac.h>
#include <openssl/md5.h>
#include <openssl/err.h>
#include <openssl/rand.h>

#include "postgres.h"
#include "utils/geo_decls.h"
#include "funcapi.h"

#ifdef PG_MODULE_MAGIC
PG_MODULE_MAGIC;
#endif

int32 isCardValid (VarChar* cardNo) {
	unsigned char serviceKard1[33], serviceKard2[33], serviceKard3[33], serviceKard4[33];
	unsigned char safeKard1[33], safeKard2[33], safeKard3[33], safeKard4[33];
	unsigned char bankKard1[33], bankKard2[33], bankKard3[33], bankKard4[33];
	unsigned char bankKard5[33], bankKard6[33], bankKard7[33], bankKard8[33];
	unsigned char enteredCard[80], FN[10], tmp[60];
	int ret = 0;
/*
....
*/
	return ret;
}

text* getSecureKeys(HeapTupleHeader t, /* the current row of emp */
           int32 secureMap)
{
    bool isnull;
    int count;
    DES_cblock userkey1 , userkey2;
    DES_key_schedule k1, k2;
    DES_cblock iv = { 0, 0, 0, 0, 0, 0, 0, 0 };

    VarChar *master1, *master2, *plainSess, *encSess;
    unsigned char masterB1[33], masterB2[33], masterBF[33], fullTxt[500];
    unsigned char bM1[16], bM2[16], *p1, *p2, bMF[16], tmp[20];
    unsigned char sessionKeyPlain[16], sessionKeyEnc[16], tmpPlain[8], tmpEnc[8];
    unsigned char sessionHexPlain[33], sessionHexEnc[33];
    unsigned char FN[33], tmpS[33];

    text *new_text = (text *) palloc(1500);
/*
..............
*/

    return new_text;
}

```

compilirt mit:

```nohighlight
gcc -fpic -c pgsecure.c -I/usr/pgsql-9.3/include/server
gcc -shared -o libpsql_native_c_lib.so ./pgsecure.o -lcrypto -lssl

```

Function mit getSecureKeys arbeitet gut.

```nohighlight
CREATE OR REPLACE FUNCTION getsecurekeys(sch.tbl_list, integer)
  RETURNS text AS
'/opt/postgresql/9.3/libs/libpsql_native_c_lib', 'getSecureKeys'
  LANGUAGE c VOLATILE STRICT
  COST 1;

```

Aber Function mit isCardValid hat einen Fehler

```nohighlight
CREATE OR REPLACE FUNCTION iscardvalid(varchar)
  RETURNS integer AS
'/opt/postgresql/9.3/libs/libpsql_native_c_lib', 'isCardValid'
  LANGUAGE c VOLATILE STRICT
  COST 1;

```

```nohighlight
ERROR: could not find function "isCardValid" in file "/opt/postgresql/9.3/libs/libpsql_native_c_lib.so"

**********Error**********

ERROR: could not find function "isCardValid" in file "/opt/postgresql/9.3/libs/libpsql_native_c_lib.so"
SQL state: 42883

```

In “libpsql\_native\_c\_lib.so” gibt es “isCardValid” Function.  
Weiß jemanden wo Problem ist?

LG, Ivan

---

<div class="post-metadata">

**Author:** ![system](https://www.pg-forum.de/uploads/default/original/1X/dc97a981dd26692d5fb52e8b8fc7c090d7b9559a.png) [@system](https://www.pg-forum.de/u/system)\
**Post date:** [21. Februar 2021 um 07:10 UTC](https://www.pg-forum.de/t/kann-nicht-c-function-finden/8980/2 "2021-02-21T07:10:46Z")

</div>

Geschlossen, am 21. Februar 2021 um 07:10 UTC


