Define Pins For Use By a Library xc8
I don't know if that changed recently, but a year ago or two I contacted Microchip technical support who confirmed that XC8 doesn't support libraries as such.

What you can do is have the C file in a "shared" folder and include it in the various projects.

The pins can be:


defined by macros (#define) either in compiler options, or in a header of a predefined name e.g. "hardwareconfig.h" which your module would include and the projects supply;
supplied at initialization by pointers to LAT/PORT registers and masks of the bits;
your module could declare functions for the low level pin handling, call those, and the various projects would implement them as they see fit.