/*foo.h - Foo declaration*/
extern "C"
int Foo (int x, int y);
/*foo.cpp - Foo implementation*/
extern "C"
int Foo (int x, int y) {
...
}
/*boo.h - declare the class*/
class CBoo
{
...
friend int Foo (int x, int y); // Foo is extern "C"
};
What i get is a compiler error (on VC6)
C2732: linkage specification contradicts earlier specification for Foo
in foo.cpp where Foo is implemented.
What is the problem and how do I fix it???
Gil Sudai.
the following compiles clean in VC++ 5.0:
*** foo.h ***
extern "C"
{
int foo(int x, int y);
}
class CBoo {
friend int foo(int x, int y);
private:
int m_n;
};
*** foo.cpp
#include "foo.h"
extern "C"
{
int foo(int x, int y)
{
CBoo * pBoo = new CBoo();
return x*y*pBoo->m_n;
}
}
void main()
{
foo(1,1);
}
Don't know what the problem is with your code, apart from the fact that
extern "C" likes {} around it's "body".
HTH Andreas
Gil Sudai <a...@abc.com> schrieb in im Newsbeitrag:
7ojsa7$487$1...@news.netvision.net.il...
George
Gil Sudai wrote in message <7ojsa7$487$1...@news.netvision.net.il>...
George Privalov <george_...@email.msn.com> wrote in message
news:enYAeUi4#GA.154@cpmsnbbsa02...
>