% Created 2019-04-30 mar. 20:01
% Intended LaTeX compiler: pdflatex
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{grffile}
\usepackage{longtable}
\usepackage{wrapfig}
\usepackage{rotating}
\usepackage[normalem]{ulem}
\usepackage{amsmath}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{capt-of}
\usepackage{hyperref}
\date{}
\title{Test of source block exports}
\hypersetup{
 pdfauthor={Emmanuel Charpentier},
 pdftitle={Test of source block exports},
 pdfkeywords={},
 pdfsubject={},
 pdfcreator={Emacs 26.1 (Org mode 9.2.3)}, 
 pdflang={English}}
\begin{document}

The R block \ref{lst:DoFig} generates the figure \ref{fig:DoFig}:

\begin{figure}[htbp]
\centering
\includegraphics[width=.9\linewidth]{Fig.png}
\caption{Figure generated by R \label{fig:DoFig}}
\end{figure}

\begin{verbatim}
curve(sin(x),from=-pi, to=pi)
\end{verbatim}
\captionof{figure}{R code generating a figure \label{lst:DoFig}}

Problem: whereas the HTML export labels the source listing as "Listing 1" and is correctly refers to 1, the PDF export labels it "Figure 2" (and points to it).
\end{document}