1 | /**************************************** |
---|
2 | * Computer Algebra System SINGULAR * |
---|
3 | ****************************************/ |
---|
4 | /*************************************************************** |
---|
5 | * File: slInit_Dynamic.cc |
---|
6 | * Purpose: link initialization for dynamic linking |
---|
7 | * Author: obachman (Olaf Bachmann) |
---|
8 | * Created: 12/00 |
---|
9 | *******************************************************************/ |
---|
10 | |
---|
11 | #include "config.h" |
---|
12 | #include <kernel/mod2.h> |
---|
13 | #include <Singular/silink.h> |
---|
14 | #include <Singular/slInit.h> |
---|
15 | #include <polys/mod_raw.h> |
---|
16 | |
---|
17 | #ifdef HAVE_DL |
---|
18 | |
---|
19 | #ifdef HAVE_DBM |
---|
20 | #include "dbm_sl.h" |
---|
21 | |
---|
22 | static void* dbm_so_handle = NULL; |
---|
23 | static void* slInitDBMHandle() |
---|
24 | { |
---|
25 | if (dbm_so_handle == NULL) |
---|
26 | dbm_so_handle = dynl_open_binary_warn("dbmsr"); |
---|
27 | |
---|
28 | return dbm_so_handle; |
---|
29 | } |
---|
30 | |
---|
31 | si_link_extension slInitDBMExtension(si_link_extension s) |
---|
32 | { |
---|
33 | void* handle = slInitDBMHandle(); |
---|
34 | |
---|
35 | if (handle == NULL) return NULL; |
---|
36 | |
---|
37 | s->Open=(slOpenProc)dynl_sym_warn(handle, "dbOpen"); |
---|
38 | s->Close=(slCloseProc)dynl_sym_warn(handle, "dbClose"); |
---|
39 | s->Kill=(slKillProc)dynl_sym_warn(handle, "dbClose"); |
---|
40 | s->Read=(slReadProc)dynl_sym_warn(handle, "dbRead1"); |
---|
41 | s->Read2=(slRead2Proc)dynl_sym_warn(handle, "dbRead2"); |
---|
42 | s->Write=(slWriteProc)dynl_sym_warn(handle, "dbWrite"); |
---|
43 | |
---|
44 | if (s->Open == NULL || s->Close == NULL || s->Kill == NULL || |
---|
45 | s->Read == NULL || s->Read2 == NULL) |
---|
46 | return NULL; |
---|
47 | |
---|
48 | s->Status=slStatusAscii; |
---|
49 | s->type="DBM"; |
---|
50 | return s; |
---|
51 | } |
---|
52 | |
---|
53 | #endif |
---|
54 | #endif |
---|
55 | |
---|