Is it possible to use global variable located in a shared library (.so) as a singleton if the library is used by more than one process?
As example the initial value is 0
If a shared library (or a Windows DLL) is used by more than one process, any modifyable data is still private to the process. There are mechanisms like Copy on Write where the same data is shared as long as it is only read, but copied as soon as it is written by either process. So, for each process the data effectively is still separate. See also shared library address space.
If you want to share data between processes, you need to use Shared Memory and make sure that access to the shared memory is synchronized between the processes.