38
|
1 .. _creating-plugins:
|
|
2
|
24
|
3 Creating new plugins
|
|
4 ====================
|
|
5
|
56
|
6 The recommended way of :ref:`contributing to the Orthanc code
|
|
7 <contributing>` consists in extending it by creating new :ref:`plugins
|
|
8 <plugins>`.
|
24
|
9
|
|
10 Overview
|
|
11 --------
|
|
12
|
|
13 Orthanc plugins must use the `plugin SDK
|
66
|
14 <http://sdk.orthanc-server.com/>`__ and must be written
|
24
|
15 in C or C++. They must also fullfil the terms of the `GPLv3 license
|
|
16 <http://www.gnu.org/licenses/quick-guide-gplv3.en.html>`__ that is
|
|
17 used by the core of Orthanc. Sample code for plugins can be found `in
|
|
18 the official Orthanc repository
|
|
19 <https://bitbucket.org/sjodogne/orthanc/src/default/Plugins/Samples/>`__
|
61
|
20 (in the ``Plugins/Samples`` folder). A
|
24
|
21 tutorial showing how to implement a basic WADO server is `available on
|
|
22 CodeProject
|
25
|
23 <http://www.codeproject.com/Articles/797118/Implementing-a-WADO-Server-using-Orthanc>`__.
|
|
24
|
|
25 We suggest developers to adopt the :ref:`coding style of the Orthanc
|
|
26 core <coding-style>`, although this is of course not required.
|
|
27
|
|
28 Do not hesitate to `contact us
|
|
29 <http://www.orthanc-server.com/static.php?page=contact>`__ if you wish
|
66
|
30 your plugin to be **indexed** in :ref:`the dedicated part of the
|
|
31 Orthanc Book <plugins-contributed>`!
|
25
|
32
|
|
33
|
|
34 Structure of the plugins
|
|
35 ------------------------
|
24
|
36
|
|
37 A plugin takes the form of a shared library (``.DLL`` under Windows,
|
67
|
38 ``.so`` under GNU/Linux, ``.dylib`` under Apple OS X...) that uses the
|
42
|
39 `ABI of the C language
|
25
|
40 <https://en.wikipedia.org/wiki/Application_binary_interface>`__ to
|
|
41 declare 4 public functions/symbols:
|
24
|
42
|
|
43 * ``int32_t OrthancPluginInitialize(OrthancPluginContext* context)``. This
|
|
44 callback function is responsible for initializing the plugin. The
|
|
45 ``context`` argument gives access to the API of Orthanc.
|
|
46 * ``void OrthancPluginFinalize()``. This function is responsible
|
|
47 for finalizing the plugin, releasing all the allocated resources.
|
|
48 * ``const char* OrthancPluginGetName()``. This function must give a
|
|
49 name to the plugin.
|
|
50 * ``const char* OrthancPluginGetVersion()``. This function must
|
|
51 provide the version of the plugin.
|
|
52
|
25
|
53 *Remark:* The size of the memory buffers that are exchanged between
|
|
54 the Orthanc core and the plugins must be below 4GB. This is a
|
|
55 consequence of the fact that the Orthanc plugin SDK uses ``uint32_t``
|
|
56 to encode the size of a memory buffer. We might extend the SDK in
|
|
57 the future to deal with buffers whose size if above 4GB.
|