Api.cpp:
int (*theFunc) (int);
theFunc = (int (*) (int)) DlSym(hSo, "theFunc");
So far so good.
Now, I want to make a header so that other cpp files can also call theFunc.
Api.h: per How to declare function pointer in header and c-file?
extern int (*theFunc)(int);
/usr/bin/ld: Warning: type of symbol `theFunc' changed from 2 to 1 in Api.o
OK, so this is a warning that theFunc is seen as a function from one compilation element and as a variable in another. (Reference) This seems like bad things will happen at runtime.
This seems to be a proper declaration, what am I doing wrong?
Edit: Actually running in linux, so use DlSym not Microsoft GetProcAddress() call