Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

link fonction c

1 réponse
Avatar
pasdespam
bonjour,

je dois utilisé une API C dans mon code C++

j'ai un probleme de link dans certaines methodes

L'API C

standardInput.h :

void Print(char *fmt, ....);

standardInput.c :

void Print(char *fmt, ....) {....}


Mon prog C++


maClasse.h :

class runnable {
public:
virtual void run() = 0;
}

class maClasse: public runnable {

void maMethode();

virtual void run();

}

maClasse.cpp :

#include "standardInput.h"

extern "C"
void* init_process(void* pt) {
maclasse* mc = (maClasse*)(pt);
mc->run();
return NULL;
}

void maClasse::maMethode() {

// ici je peux utiliser Print()

// je lance un thread
pthread_create(process, &attr, init_process, (void*)(this));


// ici je peux utiliser Print()

}

void maclasse::run() {

// erreur de link si j'utilise Print()

}


comment regler le probleme?

merci

1 réponse

Avatar
pasdespam
Bruno Causse wrote:

maClasse.cpp :

#include "standardInput.h"



Extern "C" {
#include "standardInput.h"
}