[fpc-pascal] DLL Linking
michalis at camelot.homedns.org
Wed Jun 22 15:25:24 CEST 2005
> | C:\Documents and Settings\<user name>\Application Data\<software company
> | name>\<application name>
> | Or sometimes, if the installer is set up for it:
> | C:\Documents and Settings\All Users\Application Data\<software company
> | name>\<application name>
> Yuck, and since there is no "documents and settings" directory on Linux, it's
> not a cross platform way of building apps. Of course, you've always got the
> Linux Registry at hand, which is completely compatible with the windows one
> :-( Yeah, sure.
> I'd rather write to the main program directory, because on all platforms, you
> have that directory avail. I've never been a fan of the registry either.. I
> think it's mainly abused for hiding program keys/shareware and trialware
> blockages. It's such a black hole, that people actually use it to their
> advantage.. to hide things, yes.
> | P.S. I've never used this in FPC, but run into it all the time in
> | Delphi, especially in the more locked down corporate offices, the type
> | where you have to have an IT guy scheduled a month in advance to get
> | anything installed and then you have to tell them up front every single
> | folder and registry key you'll need to read and write to.
> I feel your pain.. I guess I'm just living in dream world running Win 2000. I do
> see the "documents and settings" folder used a lot more often even in Win 2000.
> I think I may continue to design software applications to write to the local
> program directory, even if it requires some corporate pricks 30 days to set
> permissions just to get the software running. I just can't design software the
> wrong way.
Uh, don't write data to the program directory. This is not only an issue
for Windows XP, this is an issue for all operating systems with
multi-user environments, including Unices. Your program should never
modify any files inside it's directory, otherwise you're running into
many problems (security-related but also share-related, when multiple
users use and run your program). Not to mention that the "usual" program
on UNIX does not have anything like "my directory". Program data is
scattered over /bin (or /usr/bin), /etc/, /usr/share/<program-name> etc.
And you shouldn't write anything in these directories (well, unless you
really have a good reason for storing some system-wide things, that
really should be set for all users, like highscores data for games or
hardware configuration data; but then you have to carefully resolve
those security-related and share-related problems yourself).
The proper place to store user-specific settings under Windowses is to
use the mentioned
C:\Documents and Settings\<user name>\Application Data\<application name>
For UNIXes, this is
/home/<user name>/.<application name>
But actually, you should never hardcode such paths inside your program.
They may be modified by many various things by system administrator,
both under Windowses and Unices. And your program should adjust to it.
So the fact that directory like "Documents and Settings" does not exist
under Linux is not a portability problem... Because even if your program
is Win32-specific, you shouldn't hardcode anywhere the string 'Documents
Look at GetAppConfigDir and related routines from sysutils to correctly
(and portably) get directory where you should write configuration data
of your program
More information about the fpc-pascal