Главная страница | назад





Article #16663: Netscape Plug-ins SDK

 Question and Answer Database
FAQ1663C.txt Netscape Plug-ins SDK
Category :C/C++ Language Issues
Platform :All
Product :C++Builder 1.x
Question:
Has any body been able to compile a DLL using the
Netscape Plug-in SDK and Borland's development tools?
One of the header files generates an error
'CANNOT USE EXTERN "C" WITH TEMPLATES OR OVERLOADED OPERATORS'
what is going on here?
Answer:
Certain C++ constructs cannot be wrapped in extern C
because the resulting names would not be meaningful.
The extern "C" wrapper should only be used around three functions
in npwin.cpp.
But first, ensure your .dll's name starts with np:
e.g. npplugin.dll.
Second, create an export section in you're .def file with three
Netscape functions to set up entry points:
e.g.
EXPORTS
NP_GetEntryPoints @1
NP_Initialize @2
NP_Shutdown @3
Finally, you need to wrap these three functions in the npwin.cpp
with extern "C":
e.g.
extern "C"
NPError WINAPI NP_EXPORT
NP_GetEntryPoints(NPPluginFuncs* pFuncs)
etc...
A good reference that discusses how to non-MS compilers is
"Programming Netscape Plug-Ins" by Zan Oliphant.
ISBN 1-57721-098-3, published by Sams-Net.
7/2/98 10:32:32 AM

Last Modified: 01-SEP-99