~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/packages/extra/gtk2/examples/plugins/main.pas

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
program plugin_test;
 
2
 
 
3
uses
 
4
  glib2;
 
5
 
 
6
const
 
7
  PLUGIN_NAME = 'plugin';
 
8
  SYMBOL_NAME = 'get_plugin_info';
 
9
 
 
10
var
 
11
  module   : PGModule;
 
12
  func     : function : pgchar;
 
13
  id       : pgchar;
 
14
  filename : pgchar;
 
15
 
 
16
begin
 
17
  if not g_module_supported then
 
18
  begin
 
19
    g_error ('No GModule support on this platform.'#13#10);
 
20
    exit;
 
21
  end;
 
22
  filename := g_module_build_path ('.',PLUGIN_NAME);
 
23
  g_print ('Trying to locate module; using %s as filename'#13#10,
 
24
            [filename]);
 
25
 
 
26
  module := g_module_open (filename, G_MODULE_BIND_MASK);
 
27
 
 
28
  if module = NULL then
 
29
  begin
 
30
    g_error ('Couldn''t find Module %s!'#13#10, [PLUGIN_NAME]);
 
31
    exit;
 
32
  end;
 
33
 
 
34
  if not g_module_symbol (module, SYMBOL_NAME, @func) then
 
35
  begin
 
36
    g_error ('No symbol %s in %s found!'#13#10, [SYMBOL_NAME, PLUGIN_NAME]);
 
37
    g_module_close (module);
 
38
    exit;
 
39
  end;
 
40
 
 
41
  id := func();
 
42
 
 
43
  g_print ('Plugin defined itself as "%s"'#13#10, [id]);
 
44
 
 
45
  g_module_close (module);
 
46
end.