Re: [sqlite] sqlite3.c in a library - api rename

2014-10-29 Thread Roger Binns
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 10/28/2014 08:18 PM, Ward Willats wrote:
> I am using the amalgamation in a C++ library statically linked into
> other people's applications.
> 
> Is there a way to namespace and/or macro and/or let C++ do its
> name-mangling thing to all the identifiers (by running the CPP
> compiler and turning __cplusplus off) so only my library
> translation units can use this "secret" version? (Or, more like, so
> the host app doesn't accidentally use my version.)

I have another approach to this that works well.  All of my code that
interacts with SQLite is in one file.  At the top of the file I do this:

  #define SQLITE_API static
  #define SQLITE_EXTERN static
  #include "sqlite3.c"

The rest of the file references the sqlite3 api as normal.  None of
the symbols leak, and it is a little faster as the compiler can inline
static methods.

Roger


-BEGIN PGP SIGNATURE-
Version: GnuPG v1

iEYEARECAAYFAlRRB0UACgkQmOOfHg372QSELQCgoWKxiyy2RHbmZr5VKAjal/jf
3iwAoK+B9xnnME9Jg+08XIt7PB+rYrl/
=Gwsy
-END PGP SIGNATURE-
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3.c in a library - api rename

2014-10-28 Thread Ward Willats

> On Oct 28, 2014, at 8:23 PM, Richard Hipp  wrote:
> 
> On Tue, Oct 28, 2014 at 11:18 PM, Ward Willats 
> wrote:
> 
>> Hello.
>> 
>> I am using the amalgamation in a C++ library statically linked into other
>> people's applications.
>> 
>> Is there a way to namespace and/or macro and/or let C++ do its
>> name-mangling thing to all the identifiers (by running the CPP compiler and
>> turning __cplusplus off) so only my library translation units can use this
>> "secret" version? (Or, more like, so the host app doesn't accidentally use
>> my version.)
>> 
>> 
> sed 's/sqlite3/wards_db/g' sqlite3.c >wards_db.c
> sed 's/sqlite3/wards_db/g' sqlite3.h >wards_db.h
> 

Heh! Okay! :)

-- Ward
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] sqlite3.c in a library - api rename

2014-10-28 Thread Richard Hipp
On Tue, Oct 28, 2014 at 11:18 PM, Ward Willats 
wrote:

> Hello.
>
> I am using the amalgamation in a C++ library statically linked into other
> people's applications.
>
> Is there a way to namespace and/or macro and/or let C++ do its
> name-mangling thing to all the identifiers (by running the CPP compiler and
> turning __cplusplus off) so only my library translation units can use this
> "secret" version? (Or, more like, so the host app doesn't accidentally use
> my version.)
>
>
sed 's/sqlite3/wards_db/g' sqlite3.c >wards_db.c
sed 's/sqlite3/wards_db/g' sqlite3.h >wards_db.h


-- 
D. Richard Hipp
d...@sqlite.org
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] sqlite3.c in a library - api rename

2014-10-28 Thread Ward Willats
Hello.

I am using the amalgamation in a C++ library statically linked into other 
people's applications.

Is there a way to namespace and/or macro and/or let C++ do its name-mangling 
thing to all the identifiers (by running the CPP compiler and turning 
__cplusplus off) so only my library translation units can use this "secret" 
version? (Or, more like, so the host app doesn't accidentally use my version.)

Thanks,

-- Ward
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users