[fpc-pascal] DLL Linking

Steve Williams stevewilliams at kromestudios.com
Wed Jun 22 00:48:39 CEST 2005

Pianoman wrote:
>             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.

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.


This message and its attachments may contain legally privileged or confidential information. This message is intended for the use of the individual or entity to which it is addressed. If you are not the addressee indicated in this message, or the employee or agent responsible for delivering the message to the intended recipient, you may not copy or deliver this message or its attachments to anyone. Rather, you should permanently delete this message and its attachments and kindly notify the sender by reply e-mail. Any content of this message and its attachments, which does not relate to the official business of the sending company must be taken not to have been sent or endorsed by the sending company or any of its related entities. No warranty is made that the e-mail or attachment(s) are free from computer virus or other defect.

More information about the fpc-pascal mailing list