C/Biblioteki własne: Różnice pomiędzy wersjami
Usunięta treść Dodana treść
Linia 75:
-L
==numer wersji==
===w bibliotece statycznej===
Numer wersji
* w łańcuchu ( string)<ref>[http://stackoverflow.com/questions/1638207/how-to-store-a-version-number-in-a-static-library?rq=1 stackoverflow question: how-to-store-a-version-number-in-a-static-library]</ref>
* w strukturze
* w makro
Tworzymy łańcuch:
char* library_version = { "Version: 1.3.6" };
sprawdzamy z konsoli :
strings library.a | grep Version | cut -d " " -f 2
<source lang=c>
#define MYLIB_MAJOR_VERSION 1
#define MYLIB_MINOR_VERSION 2
#define MYLIB_REVISION 3
#define MYLIB_VERSION "1.2.3"
#define MYLIB_VERSION_CHECK(maj, min) ((maj==MYLIB_MAJOR_VERSION) && (min<=MYLIB_MINOR_VERSION))
</source>
<source lang=c>
struct {
const char* string;
const unsigned major;
const unsigned minor;
const unsigned revision;
} mylib_version = { MYLIB_VERSION, MYLIB_MAJOR_VERSION, MYLIB_MINOR_VERSION, MYLIB_REVISION };
</source>
=Źródła=
|