<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">Am 15.11.2022 um 20:31 schrieb Aruna
Hewapathirane:<br>
</div>
<blockquote type="cite"
cite="mid:CAFSeFg911uTL6NCG2cFUWcZDvWTq+2mW1Ex-fkYKs2cH-XoC-Q@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr"><br>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">On Tue, Nov 15, 2022 at 2:28
PM Sven Barth via lazarus <<a
href="mailto:lazarus@lists.lazarus-ide.org"
moz-do-not-send="true" class="moz-txt-link-freetext">lazarus@lists.lazarus-ide.org</a>>
wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0px 0px 0px
0.8ex;border-left:1px solid
rgb(204,204,204);padding-left:1ex">Am 15.11.2022 um 20:11
schrieb Aruna Hewapathirane via lazarus:<br>
> Hello Everyone,<br>
><br>
> I was wondering if it is possible for me to create a
library with my <br>
> own set of code snippets I use on a regular basis . Is
there any <br>
> example code I can possibly look at how this is done?<br>
><br>
> Or a small single function example if someone is
willing would help <br>
> immensely.<br>
<br>
Do you really mean a library in the sense of a DLL or SO
which requires <br>
you to pay a bit more attention to how you code it due to
the crossing <br>
of the module boundaries or do you mean a Lazarus package
which is a <br>
collection of units that Lazarus will compile for you if
necessary and <br>
that you can use freely?<br>
<br>
Regards,<br>
Sven<br>
</blockquote>
<div><br>
</div>
<div>Hi Sven, my apologies I should have been more specific
and yes it is the linux SO</div>
<div>I am specifically interested in but certainly also
interested in how to create the DLL</div>
<div>for Windows.Thanks!<br>
</div>
<br>
</div>
</div>
</blockquote>
Then please take a look here:
<a class="moz-txt-link-freetext" href="https://www.freepascal.org/docs-html/prog/progch12.html#x262-27800012">https://www.freepascal.org/docs-html/prog/progch12.html#x262-27800012</a><br>
<br>
But also pay attention to these articles on the Wiki which raise a
few issues you need to be aware of:<br>
- <a class="moz-txt-link-freetext" href="https://wiki.freepascal.org/Lazarus/FPC_Libraries">https://wiki.freepascal.org/Lazarus/FPC_Libraries</a><br>
- <a class="moz-txt-link-freetext" href="https://wiki.freepascal.org/shared_library">https://wiki.freepascal.org/shared_library</a><br>
<br>
Important points of these to keep in mind:<br>
- 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<br>
- don't pass classes between module and program<br>
- don't propagate exceptions from the module to the program (or vice
versa)<br>
<br>
Regards,<br>
Sven<br>
</body>
</html>