Is it possible to link to a function definition in a source code file, rather than a fixed line number?
Using the suggested global binding
C-c l for storing a link when you are visiting any file (not just an org-mode file) and the one for inserting a link into an org file,
C-c C-l, should work fine. It does not do the elisp
find-function bit that John Kitchin describes in his answer, but it should be adequate for almost all situations. But you need
org-context-in-file-links to be set to
t: AFAICT that has been the default since 2008, but if you get line numbers instead of context in file links, check the setting of that variable.
For elisp that is certainly possible. The general strategy might be something like:
You could add a description if you wanted to also, e.g.
For other languages it wouldn't be that easy. You can make a link like this:
which will open that file and search for the contents after the ::. Those contents are escaped.