Hi everyone, I have one question: Is it possible to link a Routine from DLL to my exe directly. Point is that I don't want distribute other files with the program and it would be nice to have only one executable nothing more.
I use Bass audio library for playback and I am interested if is it possible to link it together with my application.
Thanx
Pianoman
Mailing lists / fpc-pascal / 2005-06
DLL Linking
8 messages · 6 people · –
- LL505 2
- SSteve Williams 2
- JJeff Wormsley 1
- JJonas Maebe 1
- MMichalis Kamburelis 1
- PPianoman 1
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
Pianoman wrote 8 lines
I do not think it is possibly to link statically to dynamic libraries.
Jonas
Hi everyone, I have one question: Is it possible to link a Routine from DLL to my exe…
Pianoman wrote 6 lines
The only option here is to add the DLL file as a resource to your executable. At application start, extract the resource and write out to a temporary file in the application directory. Load the DLL via LoadLibrary, get the function address via GetProcAddress. At application end, unload the library and delete the temporary file.
Note that this is not allowed on Windows XP if your application is in the Program Files directory. Applications are not allowed or should not write to their application directory due to security restrictions.
| Note that this is not allowed on Windows XP if your application is in | the Program…
L505 wrote 14 lines
At least in Pro, and most corporate environments. User settings usually go in a subdirectory like:
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>
Note the "All Users" folder tends to be hidden. Also, these paths can be changed in the registry, so you usually have to use the ShellAPI to get them. Permissions on the former are supposed to always allow read and writes, according to the Windows guidelines, but you'll find sometimes an admin will lock them read only.
Jeff.
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.
The only option here is to add the DLL file as a resource to your executable. At…
| Note that this is not allowed on Windows XP if your application is in | the Program Files directory. Applications are not allowed or should not | write to their application directory due to security restrictions. |
| --
| Sly
Really? So MS encourages you to write everything to the main drive:\temp directory (a black hole) and not your own temp directories? This reminds me of the registry. Black hole mania.
So permissions in winxp are set like this as default?? :-(
L505 wrote 12 lines
By default, every user has their own temp directory (C:\Documents and Settings\username\Local Settings\Temp). This is what GetTempPath() will return by default, unless that user sets their TEMP environment variable to something else.
On Linux, the equivalent of "C:\Documents and
Settings\username\Application Data" would be a .appname folder in the user's home directory.
Code by the rules and you will find that you have fewer problems and more people will use your applications.
At least in Pro, and most corporate environments. User settings usually go in a…
| 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.
p.s. hope this isn't too off topic for the original poster, sorry to ruin the fun of your original question.
L505 wrote 34 lines
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 and Settings'.
Look at GetAppConfigDir and related routines from sysutils to correctly (and portably) get directory where you should write configuration data of your program
([http://www.freepascal.org/docs-html/rtl/sysutils/getappconfigdir.html]).
Michalis
