]> granicus.if.org Git - esp-idf/commitdiff
pthread: fix esp_pthread.h to compatible with c++
authormorris <maoshengrong@espressif.com>
Tue, 10 Jul 2018 09:01:56 +0000 (17:01 +0800)
committermorris <maoshengrong@espressif.com>
Wed, 11 Jul 2018 06:21:09 +0000 (14:21 +0800)
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 https://github.com/espressif/esp-idf/issues/2121
Closes https://github.com/espressif/esp-idf/issues/2172

components/pthread/include/esp_pthread.h

index ae3c2d68feddcd3e329a155f34dfe064ecdb77b9..56849328f80a43292125ad3996b860f4f1acbc09 100644 (file)
 // 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 */
@@ -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