~ubuntu-branches/ubuntu/dapper/fpc/dapper

« back to all changes in this revision

Viewing changes to rtl/os2/dynlibs.inc

  • Committer: Bazaar Package Importer
  • Author(s): Carlos Laviola
  • Date: 2004-08-12 16:29:37 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20040812162937-moo8ulvysp1ln771
Tags: 1.9.4-5
fp-compiler: needs ld, adding dependency on binutils.  (Closes: #265265)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{
 
2
    $Id: dynlibs.inc,v 1.3 2002/09/07 16:01:24 peter Exp $
 
3
    This file is part of the Free Pascal run time library.
 
4
    Copyright (c) 1999-2000 by the Free Pascal development team
 
5
 
 
6
    Implements OS dependent part for loading of dynamic libraries.
 
7
    
 
8
    See the file COPYING.FPC, included in this distribution,
 
9
    for details about the copyright.
 
10
 
 
11
    This program is distributed in the hope that it will be useful,
 
12
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 
14
 
 
15
 **********************************************************************}
 
16
 
 
17
 
 
18
{$ifdef readinterface}
 
19
 
 
20
{ ---------------------------------------------------------------------
 
21
    Interface declarations
 
22
  ---------------------------------------------------------------------}
 
23
 
 
24
type
 
25
 TLibHandle = longint;
 
26
 
 
27
const
 
28
 NilHandle = 0; 
 
29
 
 
30
{$else}
 
31
 
 
32
{ ---------------------------------------------------------------------
 
33
    Implementation section
 
34
  ---------------------------------------------------------------------}
 
35
 
 
36
uses
 
37
 DosCalls;
 
38
 
 
39
function LoadLibrary (Name: AnsiString): TLibHandle;
 
40
var
 
41
 ErrPath: array [0..259] of char;
 
42
 Handle: longint;
 
43
begin
 
44
 if DosLoadModule (@ErrPath, SizeOf (ErrPath), PChar (Name), Handle) <> 0
 
45
                                then Result := Handle else Result := NilHandle;
 
46
end;
 
47
 
 
48
function GetProcedureAddress (Lib: TLibHandle; ProcName: AnsiString): pointer;
 
49
var
 
50
 P: pointer;
 
51
begin
 
52
 if DosQueryProcAddr (Lib, 0, PChar (ProcName), P) = 0 then Result := P
 
53
                                                            else Result := nil;
 
54
end;
 
55
 
 
56
function UnloadLibrary (Lib: TLibHandle): boolean;
 
57
begin
 
58
 Result := DosFreeModule (Lib) = 0;
 
59
end;
 
60
 
 
61
{$endif}
 
62
 
 
63
{
 
64
  $Log: dynlibs.inc,v $
 
65
  Revision 1.3  2002/09/07 16:01:24  peter
 
66
    * old logs removed and tabs fixed
 
67
 
 
68
}