Move the check for whether to dlsym or GPA on linux to the common C code.

This is going to change for macos and win32, and this will be easier
than trying to spread that logic through the python code and into the
generated code.