Help me to resolve undefined reference
Francois Gouget
fgouget at free.fr
Thu Mar 28 20:06:08 CST 2002
On Thu, 28 Mar 2002, Ku Cheng wrote:
> Andriy,
>
> After putting the prototype of DisconnectNamedPipe( ) in the winbase.h
> file, finally my program can link successfully. Previously I put "extern
> bool DsiconnnecrNamedPipe ..." in my source file to avoid compilation
> error. But it still failed at linking phase. What is the difference of
> putting the declaration in winbase.h and in my local file? How is the
> winbase.h used in "winemaker" and "configure"? Is there any documentation
> explaining this?
This is a regular C vs. C++ issue, not specific to Winelib. When you
put it in your source file you were probably missing the "C" in extern
"C" ... In winebase.h all function declarations are enclosed with:
#ifdef __cplusplus
extern "C" {
#endif
...
#ifdef __cplusplus
}
#endif
So because "C" was missing, the compiler assumed it was a C++ function
and mangled the name. Then at link time there was no function by that
(mangled) name.
--
Francois Gouget fgouget at free.fr http://fgouget.free.fr/
War doesn't determine who's right. War determines who's left.
More information about the wine-devel
mailing list