Getting the current Unit Name

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Getting the current Unit Name

shiruba2012
Hi,

In Delphi, there exists: 
TObject Class Function UnitName, which allows you to get the Unit of a given class.  This seems not to be implemented in FreePascal.

If there a similar function available in FreePascal? (I am sure there is some way to do this using the VMT.)
Alternatively, is there an easy way to just return the name of the current unit?

Thank you,
    Noah Silva


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Getting the current Unit Name

leledumbo
Administrator
What compiler version? I have it in my trunk version
Reply | Threaded
Open this post in threaded view
|

Re: Getting the current Unit Name

Mattias Gaertner
In reply to this post by shiruba2012
On Sun, 14 Jul 2013 09:13:42 +0900
Noah Silva <[hidden email]> wrote:

> Hi,
>
> In Delphi, there exists: TObject Class Function UnitName, which allows you
> to get the Unit of a given class.  This seems not to be implemented in
> FreePascal.

It exists since many years in fpc.
What compiler version are you using?

 
> If there a similar function available in FreePascal? (I am sure there is
> some way to do this using the VMT.)
> Alternatively, is there an easy way to just return the name of the current
> unit?


Mattias
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal
Reply | Threaded
Open this post in threaded view
|

Re: Getting the current Unit Name

shiruba2012
Hi Mattias,

I have several different versions on different machines, so I will check it out.

Thank you for the hint!

 Thank you,
   Noah Silva


2013/7/14 Mattias Gaertner <[hidden email]>
On Sun, 14 Jul 2013 09:13:42 +0900
Noah Silva <[hidden email]> wrote:

> Hi,
>
> In Delphi, there exists: TObject Class Function UnitName, which allows you
> to get the Unit of a given class.  This seems not to be implemented in
> FreePascal.

It exists since many years in fpc.
What compiler version are you using?


> If there a similar function available in FreePascal? (I am sure there is
> some way to do this using the VMT.)
> Alternatively, is there an easy way to just return the name of the current
> unit?


Mattias
_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal


_______________________________________________
fpc-pascal maillist  -  [hidden email]
http://lists.freepascal.org/mailman/listinfo/fpc-pascal