Recent

Author Topic: Library - How to get it's path  (Read 3218 times)

EasyTEF Team

  • New Member
  • *
  • Posts: 26
Library - How to get it's path
« on: October 24, 2010, 02:06:59 pm »
Hi folks  :)

I'm developing a library in Lazarus + Linux and I want to get the fullpath of this library.

On Windows, I have GetModuleName API function, but on Linux there is no such thing. I don't wanna use ParamStr(0) because if a Java program use my library, ParamStr(0) will return the java executable path, right?

So, how can I get my library path?

Thanx

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12593
  • FPC developer.
Re: Library - How to get it's path
« Reply #1 on: October 24, 2010, 02:18:46 pm »
Moreover, paramstr(0) doesn't always work on Linux. (e.g. on some filesystem types, specially remote ones).  OS X and FreeBSD also don't.

Since libraries are not memory mapped on *nix, the way they are on Windows, this whole concept doesn't exist. (in Windows you can't delete a loaded .dll, but you can delete an active .so on Linux)

In general it is best to redesign so that this functionality is not necessary.

 

TinyPortal © 2005-2018