Difference between uos and uoslib, Delphi

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Difference between uos and uoslib, Delphi

darekdarek
What is a difference between uos and uoslib packages?
Which should i choose to work with Delphi (Embarcadero) or Lazarus?

Both don't work for me: invalid compiler directive: 'mode ' for {$mode objfpc}{$H+}
etc ...

DB
Reply | Threaded
Open this post in threaded view
|

Re: Difference between uos and uoslib, Delphi

fredvs
Administrator
This post was updated on .
Hello and welcome to uos forum.

uos is the source-core and is written in Pascal.
All the uos-units can be used for a application compiled with fpc (Free Pascal Compiler).

uoslib is the library version of uos.
It is a native library that can be used for other languages too, like C or Python.
But, like every library, uoslib must be loaded and a header must be used.

So, to resume, Pascal fpc-lazarus developers should use directly uos (but it is possible to use uoslib too).

The easier way to try uos is to run the demos that are in /uos/examples.

uos is not yet ready for Delphi, only fpc (Free Pascal included Lazarus) is implemented.

For Delphi, you may use uoslib (uoslib must be compiled with fpc) as a external library.

Fre;D

Reply | Threaded
Open this post in threaded view
|

Re: Difference between uos and uoslib, Delphi

darekdarek
Oh, hello :)
Thanks for the explanation.
I used 'uos' (instead of 'uoslib'), 'uos_flat' (instead of 'uos' in uses section) and Lazarus (instead of Delphi). It works!

But I have 2 questions:

- should I match the version of DLL files (32/64 bit) to the version of Windows on which the program is running, or to the compilation version? Windows has 64 bit and compiles the application as 32 bit. Which versions of dll-s should i use?

- should I use 'uos_unloadlib' or 'uos_free' when exiting the program?
Reply | Threaded
Open this post in threaded view
|

Re: Difference between uos and uoslib, Delphi

fredvs
Administrator
This post was updated on .
Hello.

Nice that you make it work!

uos is a framework that can link the best open-source libraries.

To connect with the sound-card: PortAudio library.
To decode wav, flac, ogg audio files: SoundFile library.
To decode mp3 audio files: Mpg123 library.

All the binaries of those libraries are included in uos package in /uos/examples/lib.

For Windows, Linux, MacOS and FreeBSD both 64 bit and 32 bit libraries are included.

You must use the same bit format as your program, so if you compiled your application with fpc 64 bit, you must use the 64 bit libraries.
The same for a 32 bit application, it can only deal with 32 bit libraries.

Windows 10 is by default multi-arch, so you may run 64 bit and 32 bit applications.
But Windows 7 can be 32 bit or 64 bit, depend of the version.
So, to be universal, a Windows application should be 32 bit.

The good news is that with uos you can have 32 or/and 64 bit applications with the same code.

About last method when exiting program, it is uos_free().
It will free all the libraries loaded and also free the players that are not yet freed.

uos uses dynamic loading of libraries, you may load the library when you want (usually at init of application) and also you may unload some or all libraries when you want.

In that case, uos_unloadlib is used.
But this is when you need to use some audio in your application at a moment and want to free the memory used, for example a audio-splash screen.

IMHO, it would be easier for you to load+compile+run the demos in /uos/examples using Lazarus - Open Project (and choose one *.lpi project).
You may begin with the "consolexxx.lpi" examples, they are simple console audio demos.

After this, you may attack some GUI application, like SimplePlayer demo.