[Gambas-user] Creating a library

gambas at ...1938... gambas at ...1938...
Thu Sep 4 18:53:15 CEST 2008


Am Donnerstag, 4. September 2008 16:39:06 schrieb Doriano Blengino:

> Make a (dummy?) project with your libray in it; give it a meaningful name.
> Edit the library source: put a "EXPORT" alone in a line at the beginning:
>
>     ' Gambas module file
>
>     EXPORT
>
>     PUBLIC SUB printit(st AS String)
>
>       PRINT st
>
>     END
>
> Run the project, or compile it.
> Go to the project properties (General, Options, Components...); in the
> "Options" tab set "This project is a component" to YES; further tabs
> should appear on the right of the window (Provides and Requires).
> Go the tab "Provides", and click on the line starting with your library
> name, under the column "Type", and set "Class".
> Confirm with "OK".
>
> Next, create an executable: Main menu/Project/Create/Executable; a
> window will open asking for a location.
> For this kind of things, I use the same path as the project, but could
> be better to choose a location accessible by other users too, I don't
> know. Before continuing, expand the last item in the window named
> "Options": two checkboxes will appear. Check the "Install components in
> the user directory" or something similar.
>
> Confirm with OK.
>
> Quit Gambas. In your home directory you shoud find two directories:
>
>   .local/lib/gambas2/
>   .local/share/gambas2/
>
> with things inside them (symbolic links to the executable you created
> before).
> If you don't find ~/.local, or one of the other subdirectory, try to
> create them and repeat the create executable step. I don't remember
> whther gambas creates them automatically or it expects them to be there.
>
> Restart gambas, open/create another project (not the old one, I
> suppose...), go to the project properties under the section
> "Components". In the list of available components, you should find a
> line containing the name of the project you did in the first step. Check
> it, and now in your project you can use the methods declared in your
> library.
> Referring to the source code above, I called that module "alib", and put
> it inside a project "provalib". So, in another project, I can check the
> line "provalib", and the methods are accessible by writing
> "alib.printit()".
>
> Some notes:
>
> I use gambas 2.0.0, quite an old version, with italian localization.
> Your version could be a little different...
>
> I am testing what I am just writing to you, and it works. But there
> could be better/preferrable methods.
>
> Good luck, hope this solves.

Hi Doriano,

thank you so much for this guide.  :-)
I will check this, with my current version of Gambas!

Greetz
Stevie





More information about the User mailing list