Hi Chris,
Thanks for your reply. I do have a different way of handling it in C# but I am passing the call on to the sqlite_vmprintf function (in printf.c and that accepts a va_list)
The way around it that I use is having a switch statement and if the use passes one parameter the I calls sqlite_vmprintf with one parame , if two it calls it with two and so on. If I could build a va_list then I would built it and just call sqlite_vmprintf once.
Hi Greg,
it *might* work building up a (CPU-)stack-like structure holding all the parameters, which, of course should be only int's and const char*. To outline this, have a look at this example, which is C++:
struct value {
enum Type { Int, String } type;
int i;
std::string s;
};typedef vector<value> Values;
void run_vprintf(const char* fmt, const Values& v)
{
//
// The size of a single element
unsigned el = max(sizeof(int), sizeof(char*); //
// allocate a memory block for all values in v.
// Will be freed automatically on return
char* p = (char*) alloca(v.size() * el);
//
// The stack, as we are used to it, grows downwards.
// If it wouldn't we had to use begin()/end() here.
Values::const_reverse_iterator it = v.rbegin();
Values::const_reverse_iterator end = v.rend(); while(it != end) {
switch(it->type) {
case value::Int:
*(int*)d = it->i;
break;
case value::String:
*(char*)d = it->s.c_str();
break;
}
++it;
} // now we put the values on to a pseudo "stack".
// Create a va_arg for the first parameter. In the downward
// growing scenario this is at p + (v.size()-1)*el
va_list ap;
va_start(ap, (int&)(p + (v.size()-1)*el));// now do whatever you want... }
well, above code is what I would try... and of course, it is fully nonportable. Maybe I would consider not using sqlite_vmprintf)( at all.
/eno
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

