sqlite3_version is not a function.  it is the "location" of the version string.

The definition of sqlite3_version is:

char sqlite3_version[];
equivalent to
char *sqlite3_version;

not a function that returns a pointer.  

It is a pointer to a zero terminated string (or rather the address of the first 
character of the zero-terminated version string)

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a 
lot about anticipated traffic volume.


>-----Original Message-----
>From: sqlite-users [mailto:sqlite-users-
>boun...@mailinglists.sqlite.org] On Behalf Of Papa
>Sent: Friday, 25 August, 2017 20:56
>To: SQLite mailing list
>Subject: [sqlite] C++ sqlite_version()
>
>In my C++ program, I'd like to display the SQLite3 version. To do so,
>this is what I have done.
>
>class SQLite3_RDB {
>     private:
>         sqlite3* db; //!< Data Base
>         std::string tmp;
>    public:
>         SQLite3_RDB(){}
>         ~SQLite3_RDB(){sqlite3_close(db); }
>         const std::string& getSQLiteVersion();
>
>};
>
>const std::string& SQLite3_RDB::getSQLiteVersion(){
>     tmp = sqlite_version();
>}
>
>However, as soon as I call the getSQLiteVersion() class member
>function,
>I get a "program failure". The gdb reports 'Signal received: SIGSEGV
>(Segmentation fault)'
>What am I doing wrong?
>
>--
>ArbolOne.ca
>Using Fire Fox and Thunderbird.
>ArbolOne is composed of students and volunteers dedicated to
>providing free services to charitable organizations.
>ArbolOne on Java Development in progress [ í ]
>
>_______________________________________________
>sqlite-users mailing list
>sqlite-users@mailinglists.sqlite.org
>http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users



_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to