I'm not certain I understand the question about a "link function based on a variable". If you give more details about the link you want to use folks may be able to help you more.
That being said, one example of a user-defined link based on an additional variable is the "logistic exposure" link. You can see an example in this RPub (see Method 2). It's also discussed in this CrossValidated answer.
This may or may not be relevant to what you are trying to do. 