[sqlite] Regarding SQLITE_PRIVATE

2015-05-15 Thread Sairam Gaddam
On Fri, May 15, 2015 at 4:46 PM, Hick Gunter  wrote:

> The keyword "static" before a function name limits its visibility to the
> current source file.
>
> But many of the PRIVATE functions are not declared static like the 
> "sqlite3VdbePrintOp"
function.
If they do declare, can i know where they did that?


[sqlite] Regarding SQLITE_PRIVATE

2015-05-15 Thread Sairam Gaddam
On Fri, May 15, 2015 at 4:42 PM, Simon Slavin  wrote:
>
>
> By not declaring them in the header file you're meant to be using ?
>

But I think they are declared in the header.

>
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
>


[sqlite] Regarding SQLITE_PRIVATE

2015-05-15 Thread Sairam Gaddam
On Fri, May 15, 2015 at 3:53 PM, Hick Gunter  wrote:

> SQLITE_PRIVATE means that the function is PRIVATE.


How they achieved PRIVATE functions in C?

You are not allowed to call this function, it is not supported as part of
> the SQLite API. Because you are not allowed to call the function directly,
> it is not made available to the linker.
>

How those functions are made invisible to the linker?


[sqlite] Regarding SQLITE_PRIVATE

2015-05-15 Thread Eduardo Morras
On Fri, 15 May 2015 17:13:32 +0530
Sairam Gaddam  wrote:

> On Fri, May 15, 2015 at 4:46 PM, Hick Gunter  wrote:
> 
> > The keyword "static" before a function name limits its visibility
> > to the current source file.
> >
> > But many of the PRIVATE functions are not declared static like the
> > "sqlite3VdbePrintOp"
> function.
> If they do declare, can i know where they did that?

In amalgamation you can search in sqlite3.h for these defines:

#define SQLITE_PRIVATE static
#define SQLITE_API extern

Some lines up, you find in what .h file they are declared.

By default all functions in C are of type extern (if you don't add static, they 
are extern), so, if you declare them on .h file they can be called from other 
.c files. If you don't declare them on .h but at top of .c file where they are 
implemented they can't be called from other .c files. If you declare them as 
static, you can't call them from any other .c files.

HTH

---   ---
Eduardo Morras 


[sqlite] Regarding SQLITE_PRIVATE

2015-05-15 Thread Simon Slavin

On 15 May 2015, at 12:43pm, Sairam Gaddam  wrote:

> If they do declare, can i know where they did that?

Search your project and find out where your compiler is picking up the function 
name from.

But as Hick answered you previously, you should not call that function.  It may 
change or disappear in the next version of SQLite.

Simon.


[sqlite] Regarding SQLITE_PRIVATE

2015-05-15 Thread Simon Slavin

On 15 May 2015, at 12:10pm, Sairam Gaddam  wrote:

> How they achieved PRIVATE functions in C?

By not declaring them in the header file you're meant to be using ?

Simon.


[sqlite] Regarding SQLITE_PRIVATE

2015-05-15 Thread Hick Gunter
The keyword "static" before a function name limits its visibility to the 
current source file.

-Urspr?ngliche Nachricht-
Von: Sairam Gaddam [mailto:gaddamsairam at gmail.com]
Gesendet: Freitag, 15. Mai 2015 13:10
An: General Discussion of SQLite Database
Betreff: Re: [sqlite] Regarding SQLITE_PRIVATE

On Fri, May 15, 2015 at 3:53 PM, Hick Gunter  wrote:

> SQLITE_PRIVATE means that the function is PRIVATE.


How they achieved PRIVATE functions in C?

You are not allowed to call this function, it is not supported as part of
> the SQLite API. Because you are not allowed to call the function
> directly, it is not made available to the linker.
>

How those functions are made invisible to the linker?
___
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___
 Gunter Hick
Software Engineer
Scientific Games International GmbH
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: hick at scigames.at

This communication (including any attachments) is intended for the use of the 
intended recipient(s) only and may contain information that is confidential, 
privileged or legally protected. Any unauthorized use or dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please immediately notify the sender by return e-mail message and 
delete all copies of the original communication. Thank you for your cooperation.




[sqlite] Regarding SQLITE_PRIVATE

2015-05-15 Thread Hick Gunter
SQLITE_PRIVATE means that the function is PRIVATE. You are not allowed to call 
this function, it is not supported as part of the SQLite API. Because you are 
not allowed to call the function directly, it is not made available to the 
linker.
You can call it indirectly through the EXPLAIN feature.

By changing from SQLITE_PRIVATE to SQLITE_API (commonly referred to as 
"hacking") you are making it visible to the linker. And thus callable from your 
program.

So the answer to your question is

1) because it is invisible
2) use EXPLAIN to output the generated VDBE code

BTW: It is good practice to finalize a prepared statement before closing the db 
handle.


-Urspr?ngliche Nachricht-
Von: Sairam Gaddam [mailto:gaddamsairam at gmail.com]
Gesendet: Freitag, 15. Mai 2015 11:27
An: General Discussion of SQLite Database
Betreff: [sqlite] Regarding SQLITE_PRIVATE

http://pastebin.com/yLx1L0uu

When I run the above program, I got the following error

undefined reference to `sqlite3VdbePrintOp'

since the "sqlite3VdbePrintOp" function is SQLITE_PRIVATE But when I change 
SQLITE_PRIVATE to SQLITE_API, I was able to access the function.
Can anyone tell why can't I access in the former case and Is there any way to 
access the same when it is SQLITE_PRIVATE ?
___
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


___
 Gunter Hick
Software Engineer
Scientific Games International GmbH
FN 157284 a, HG Wien
Klitschgasse 2-4, A-1130 Vienna, Austria
Tel: +43 1 80100 0
E-Mail: hick at scigames.at

This communication (including any attachments) is intended for the use of the 
intended recipient(s) only and may contain information that is confidential, 
privileged or legally protected. Any unauthorized use or dissemination of this 
communication is strictly prohibited. If you have received this communication 
in error, please immediately notify the sender by return e-mail message and 
delete all copies of the original communication. Thank you for your cooperation.




[sqlite] Regarding SQLITE_PRIVATE

2015-05-15 Thread Richard Hipp
On 5/15/15, Sairam Gaddam  wrote:
> http://pastebin.com/yLx1L0uu
>
> When I run the above program, I got the following error
>
> undefined reference to `sqlite3VdbePrintOp'
>
> since the "sqlite3VdbePrintOp" function is SQLITE_PRIVATE
> But when I change SQLITE_PRIVATE to SQLITE_API, I was able to access the
> function.
> Can anyone tell why can't I access in the former case and Is there any way
> to access the same when it is SQLITE_PRIVATE ?

Functions marked SQLITE_PRIVATE are for internal use only.  They
change frequently and without notice.  (One SQLITE_PRIVATE routine was
change in an incompatible way and another was completely removed, just
a few hours ago.)  Between any two point releases of SQLite, you can
expect that dozens of SQLITE_PRIVATE functions will be added, deleted,
and/or modified in ways that would break any application that linked
against them.  Furthermore, those functions have not been tested for
arbitrary inputs, but only inputs that they could have received when
called from inside of SQLite.

Hence, you should never, never use an SQLITE_PRIVATE function in your program.
-- 
D. Richard Hipp
drh at sqlite.org