I do this in my extensions all the time by passing a parameter in the pApp and checking its value in the function using the sqlite3_user_data API as Richard suggests -- this is why that functionality exists.
```
sqlite3_create_function(db,"daysinmonth",3,cf_flags,(void*)0,days_in_month,0,0);
sqlite3_create_function(db,"dim",3,cf_flags,(void*)1,days_in_month,0,0);
```
then inside days_in_month you simply use the passed value:
```
if ((intptr_t)sqlite3_user_data(context) == 0)
{
... user called daysinmonth" ...
}
if ((intptr_t)sqlite3_user_data(context) == 1)
{
... user called "dim" ...
}
```
The same can be used for aggregate and window functions as well. In fact, I have some functions that use the same C function to implement dozens of different API functions (ie, the SQL functions all implement the same thing just slightly differently differently -- for example a Hash function which can use any of a dozen different algorothms).
NB: Edited the typo (void^)1 to the correct (void*)1