OS/2 DLL's

Sun, 13 Oct 1996 00:08:37 +0200 (MESZ)


Hello,

After some experimenting, I produced an OS/2 dynamic link library (DLL)
with GNU Pascal that I could call from another application. Perhaps this
is common knowledge but I do not see it documented anywhere.

The following seems to work compiled with the latest emx distribution of
GPC using "gpc -Zomf -Zdll cube.pas cube.def":

unit cube; { a simple function in a DLL}

interface
function cubit(x:integer):integer;

implementation
function cubit(x:integer):integer;
begin
    cubit := x*x*x;
end;
end.

You have to be careful in the module definition file to list the function
with only the first letter capitalized or LINK386.EXE will complain:

/* module definition file for Cube dll */
LIBRARY CUBE
EXPORTS
    Cube    @1



Allan D. Derickson -- Derickson Forestry Services -- Freeland, WA  USA 
-----------------------------------------------------------
alland@whidbey.com
-----------------------------------------------------------


********************************
ACHTUNG: Neue e-mail-Adresse!
Ab dem 22. Juni 1996 bitte an
  peter.gerwinski@uni-essen.de
schreiben.
********************************
ATTENTION: New e-mail address!
>From 22. June 1996 on 
please write to
  peter.gerwinski@uni-essen.de
********************************
--------------------------------------------------------------------------------
Dipl. Phys. Peter Gerwinski
Fachbereich Physik
Universitaet-GH Essen                       Phone:  +49-201-183-2763
D-45117 Essen                               Fax:    +49-201-183-2120
Germany                                     e-mail: peter.gerwinski@uni-essen.de
--------------------------------------------------------------------------------


Peter Gerwinski (phy0a0@spf1.power.uni-essen.de (Peter Gerwinski))

HTML conversion by Lluís de Yzaguirre i Maura
Institut de Lingüística Aplicada - Universitat "Pompeu Fabra"
e-mail: de_yza@upf.es