I'm new to OpenGL, and I'm wondering what I need to pay attention to regarding versioning. The things I've been reading have been clear about there being version differences, and needing the appropriate OpenGL version for the functionality you're using. But they've mainly been talking about compiling and running programs on a single machine. For the most part they haven't explicitly dealt with complexities regarding compiling on one machine and running on another. (Specifically, what happens if the computer you're running on has an older version of OpenGL than the one you're compiling on.)
For example, take glDrawElementsInstanced. The Khronos page indicates this is available with OpenGL 3.1 and later. Obviously, if the headers for OpenGL on the machine I'm compiling for are version 3.0 or earlier, I'll get a compiler error. So on the machine I'm compiling on, I'll need to have OpenGL 3.1+ available.
However, I'm wondering what might happen if the machine I compile for has OpenGL 3.1+ available, but the machine I'm running on only has support for 3.0 or earlier? Will the program that uses glDrawElementsInstanced refuse to load? Will it run but crash once I call the glDrawElementsInstanced() function? Will it work fine because the actual implementation is compiled into my program, and it only uses common back-end functionality? Is the answer different for static versus dynamic linkage? -- And perhaps most importantly, if it wasn't glDrawElementsInstanced but some other function, is there a way I can determine this on my own?
I'm interested in distributing on Windows, Mac and Linux, so if there's any differences in behavior between the platforms in this regards, I'd be interested in knowing.