Board index » delphi » help with using OBJ-files

help with using OBJ-files

I don't know how to use an object file in pascal. I have the file i'm
going to use test.obj containing boolean filename password; but how do i
use it?

All help appreciated

-- Tom Schultz
  ******************************************
 ** Schultz  E-Mail : <rosch...@online.no> **
 ** NORWAY                                 **
  ******************************************

 

Re:help with using OBJ-files


Quote
In article <324BD073.7...@online.no>, Roger Schultz <rosch...@online.no> writes:
> I don't know how to use an object file in pascal. I have the file i'm
> going to use test.obj containing boolean filename password; but how do i
> use it?

> All help appreciated

A more detailed description of your environment would help.

Since this was not posted to comp.lang.pascal.mac, we can
presume your question is not for Macintosh, where the
answer differs depending on which of the 4 available
Pascal compilers you use.

For VMS, you declare the boolean password as an external
and link the object file in as you do the object files
created by the Pascal compiler.  Personally I think
a boolean password is too simple to guess.

Others may provide answer for other environments,
and perhaps one of them will describe yours.

Larry Kilgallen

Re:help with using OBJ-files


Quote
Roger Schultz wrote:

> I don't know how to use an object file in pascal. I have the file i'm
> going to use test.obj containing boolean filename password; but how do i
> use it?

> All help appreciated

> -- Tom Schultz
>   ******************************************
>  ** Schultz  E-Mail : <rosch...@online.no> **
>  ** NORWAY                                 **
>   ******************************************

I am not sure of what you mean by saying "use .OBJ file". I assume that
you have a function written in assembly or some other language, contained
in object (relocatable) form in the .OBJ file, and that you are talking
about TP/BP. In this case you should find (probably from some
documentation) the public name of the function and other things, such as
whether it is declared NEAR or FAR, the number and type of its arguments,
etc.

Based on this information, you could declare the function, e.g.

        FUNCTION Check_Password:BOOLEAN; FAR; EXTERNAL;
          {$L C:\SOMEDIR\TEST.OBJ}

The EXTERNAL directive tells the compiler that the function is to be
found in a .OBJ file.

The {$L ...} directive tells the linker what the file is.

The FAR directive determines the call type of the function and it could
be NEAR instead.

The result type and the parameters passed (if any) must be those expected
by the external function.

Beware, that functions written in C use a different calling convention
(except when explicitly declared as PASCAL) and will probably crash if
they are called from a Pascal program.

I hope I have helped

Votis

------------------------------------------

Votis Kokavessis
Mathematics teacher & pascal programmer
Thessaloniki, Greece
E-mail address: paratiritis.the.forthnet...@popper.forthnet.gr (votis)

Re:help with using OBJ-files


{$L Test.Obj}
{$F+}
function Ask_For_Password : Boolean; External;
{$F-}

..

   IF Ask_For_Password THEN
      OK
   ELSE
      Go Stranger;

   Hope this helps.

Quote
Roger Schultz <rosch...@online.no> wrote:
>I don't know how to use an object file in pascal. I have the file i'm
>going to use test.obj containing boolean filename password; but how do i
>use it?

>All help appreciated

>-- Tom Schultz
>  ******************************************
> ** Schultz  E-Mail : <rosch...@online.no> **
> ** NORWAY                             **
>  ******************************************

--

          ___                                              ___
          L_|_                                            _|_J
         ( -O>                                            <O- )
      ___//\J  __________________________________________  L/\\___
     //-,\    |                                          |    /,-\\
    || / \\___L   AVONTURE Christophe (c) AVC Software   J___// \ ||
  _ ''/\/ '---J    Christophe.Avont...@is.belgacom.be    L---' \/\'' _
 / \ //\\.    |__________________________________________|    .//\\ / \
|_/\'/  ||                                                    ||  \'/\_|
     '   ||_         "Make sure that, always!, you            _||   '
         |__)       reply to my private mail adress"         (__|

Delphi Super Page: http://sunsite.icm.edu.pl/archive/delphi/_index.html
Delphi Super Site: http://sunsite.icm.edu.pl/~robert/delphi
Delphi Others:     http://www.coast.net/~jkeller
                   http://www.pobox.com/~bstowers/delphi

 "Postings are personnal, and don't reflect Belgacom's opinion"

Other Threads