]> git.sur5r.net Git - openldap/blob - servers/slapd/back-perl/init.c
Use -lldap_r instead of -lldap -lthread.
[openldap] / servers / slapd / back-perl / init.c
1 /*
2  *       Copyright 1999, John C. Quillan, All rights reserved.
3  *
4  *       Redistribution and use in source and binary forms are permitted only
5  *       as authorized by the OpenLDAP Public License.  A copy of this
6  *       license is available at http://www.OpenLDAP.org/license.html or
7  *       in file LICENSE in the top-level directory of the distribution.
8  */
9
10 #include "portable.h"
11  /* init.c - initialize shell backend */
12         
13 #include <stdio.h>
14 /* #include <ac/types.h>
15         #include <ac/socket.h>
16 */
17
18 #include <EXTERN.h>
19 #include <perl.h>
20
21
22 #include "slap.h"
23 #include "perl_back.h"
24
25
26 PerlInterpreter *perl_interpreter = NULL;
27 ldap_pvt_thread_mutex_t perl_interpreter_mutex;
28
29
30 /**********************************************************
31  *
32  * Init
33  *
34  **********************************************************/
35
36 void
37 perl_back_init(
38         Backend *be
39 )
40 {
41         char *embedding[] = { "", "-e", "0" };
42
43         if( perl_interpreter == NULL ) {
44                 perl_interpreter = perl_alloc();
45                 perl_construct(perl_interpreter);
46                 perl_parse(perl_interpreter, NULL, 3, embedding, (char **)NULL);
47                 perl_run(perl_interpreter);
48                 
49                 ldap_pvt_thread_mutex_init( &perl_interpreter_mutex,
50                         ldap_pvt_thread_mutexattr_default );
51         }
52
53         be->be_private = (PerlBackend *) ch_malloc( sizeof(PerlBackend) );
54         memset(&be->be_private, 0, sizeof(PerlBackend));
55
56         Debug( LDAP_DEBUG_ANY, "Here in perl backend\n", 0, 0, 0 );
57 }
58