Skip to content

Commit

Permalink
pthread: fix esp_pthread.h to compatible with c++
Browse files Browse the repository at this point in the history
esp_pthread.h is missing the necessary extern "C"{ ... } wrapper to be compatible with C++. The result is link errors when you call its functions from C++ code, because the compiler generates mangled names.

Closes espressif#2121
Closes espressif#2172
  • Loading branch information
suda-morris committed Jul 11, 2018
1 parent 82047ff commit 5c6e1e6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions components/pthread/include/esp_pthread.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#pragma once

#ifdef __cplusplus
extern "C" {
#endif

#include <pthread.h>

/** pthread configuration structure that influences pthread creation */
Expand Down Expand Up @@ -55,3 +62,6 @@ esp_err_t esp_pthread_set_cfg(const esp_pthread_cfg_t *cfg);
*/
esp_err_t esp_pthread_get_cfg(esp_pthread_cfg_t *p);

#ifdef __cplusplus
}
#endif

0 comments on commit 5c6e1e6

Please sign in to comment.