Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2022-11

Creating a library

5 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Aruna Hewapathirane

Hello Everyone,

I was wondering if it is possible for me to create a library with my own set of code snippets I use on a regular basis . Is there any example code I can possibly look at how this is done?

Or a small single function example if someone is willing would help immensely.

Thank you.

Aruna Hewapathirane
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20221115/ed065b6b/attachment.htm>

Reply by email

Sven Barth
to Aruna Hewapathirane
Aruna Hewapathirane wrote 8 lines
Hello Everyone, I was wondering if it is possible for me to create a library with my own set of code snippets I use on a regular basis . Is there any example code I can possibly look at how this is done? Or a small single function example if someone is willing would help immensely.

Do you really mean a library in the sense of a DLL or SO which requires you to pay a bit more attention to how you code it due to the crossing of the module boundaries or do you mean a Lazarus package which is a collection of units that Lazarus will compile for you if necessary and that you can use freely?

Regards,
Sven

Reply by email

Aruna Hewapathirane
to Sven Barth

On Tue, Nov 15, 2022 at 2:28 PM Sven Barth via lazarus <

Show quoted text 21 lines
wrote: Am 15.11.2022 um 20:11 schrieb Aruna Hewapathirane via lazarus: > Hello Everyone, > > I was wondering if it is possible for me to create a library with my > own set of code snippets I use on a regular basis . Is there any > example code I can possibly look at how this is done? > > Or a small single function example if someone is willing would help > immensely. Do you really mean a library in the sense of a DLL or SO which requires you to pay a bit more attention to how you code it due to the crossing of the module boundaries or do you mean a Lazarus package which is a collection of units that Lazarus will compile for you if necessary and that you can use freely? Regards, Sven

Hi Sven, my apologies I should have been more specific and yes it is the linux SO
I am specifically interested in but certainly also interested in how to create the DLL
for Windows.Thanks!

Show quoted text 5 lines
_______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20221115/eba3a0b4/attachment.htm>

Reply by email

Sven Barth
to Aruna Hewapathirane
Aruna Hewapathirane wrote 34 lines
On Tue, Nov 15, 2022 at 2:28 PM Sven Barth via lazarus wrote: Am 15.11.2022 um 20:11 schrieb Aruna Hewapathirane via lazarus: > Hello Everyone, > > I was wondering if it is possible for me to create a library with my > own set of code snippets I use on a regular basis . Is there any > example code I can possibly look at how this is done? > > Or a small single function example if someone is willing would help > immensely. Do you really mean a library in the sense of a DLL or SO which requires you to pay a bit more attention to how you code it due to the crossing of the module boundaries or do you mean a Lazarus package which is a collection of units that Lazarus will compile for you if necessary and that you can use freely? Regards, Sven Hi Sven, my apologies I should have been more specific and yes it is the linux SO I am specifically interested in but certainly also interested in how to create the DLL for Windows.Thanks!

Then please take a look here:
https://www.freepascal.org/docs-html/prog/progch12.html#x262-27800012

But also pay attention to these articles on the Wiki which raise a few issues you need to be aware of:
- https://wiki.freepascal.org/Lazarus/FPC_Libraries
- https://wiki.freepascal.org/shared_library

Important points of these to keep in mind:
- don't allocate memory in the module and release in the program (or vice versa) - unless you use a common memory manager between them like ShareMem or cmem - this also includes strings and arrays
- don't pass classes between module and program
- don't propagate exceptions from the module to the program (or vice versa)

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20221115/9040de8f/attachment.htm>

Reply by email

Aruna Hewapathirane
to Sven Barth

On Tue, Nov 15, 2022 at 3:50 PM Sven Barth via lazarus <

Show quoted text 38 lines
wrote: Am 15.11.2022 um 20:31 schrieb Aruna Hewapathirane: On Tue, Nov 15, 2022 at 2:28 PM Sven Barth via lazarus < > wrote: > Am 15.11.2022 um 20:11 schrieb Aruna Hewapathirane via lazarus: > > Hello Everyone, > > > > I was wondering if it is possible for me to create a library with my > > own set of code snippets I use on a regular basis . Is there any > > example code I can possibly look at how this is done? > > > > Or a small single function example if someone is willing would help > > immensely. > > Do you really mean a library in the sense of a DLL or SO which requires > you to pay a bit more attention to how you code it due to the crossing > of the module boundaries or do you mean a Lazarus package which is a > collection of units that Lazarus will compile for you if necessary and > that you can use freely? > > Regards, > Sven > Hi Sven, my apologies I should have been more specific and yes it is the linux SO I am specifically interested in but certainly also interested in how to create the DLL for Windows.Thanks! Then please take a look here: https://www.freepascal.org/docs-html/prog/progch12.html#x262-27800012

Thank you, this is what I was looking for. Very much appreciate you taking the time to help a noob. That is
some serious documentation by the way.. :-)

Show quoted text 7 lines
But also pay attention to these articles on the Wiki which raise a few issues you need to be aware of: - https://wiki.freepascal.org/Lazarus/FPC_Libraries - https://wiki.freepascal.org/shared_library

Understood and shall comply. Thank you again!

Show quoted text 12 lines
Important points of these to keep in mind: - don't allocate memory in the module and release in the program (or vice versa) - unless you use a common memory manager between them like ShareMem or cmem - this also includes strings and arrays - don't pass classes between module and program - don't propagate exceptions from the module to the program (or vice versa) Regards, Sven

Once again thank you very much for your time Sven.

Aruna

Show quoted text 6 lines
-- _______________________________________________ lazarus mailing list https://lists.lazarus-ide.org/listinfo/lazarus

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20221116/8365732d/attachment.htm>

Reply by email