Here is the whole story.
I am building a filter driver and am statically linking in several libraries.
The libraries are built using the “-shared” flag and linked into an archive
using ar. I add the libs to the “LIBS” line in the filter makefile. When i try
to load the driver into io-net, io-net crashes. I have linked in a single
library successfully, therefore the problem is likely one or more of the
libraries that i am linking in, or due to the number of libs linked in. Io-net
crashes when loading the driver, and execution does not reach my filters init
function. Here are a couple of areas risk areas, that i feel are causing
problems.
When loading the single lib which contains exception handling, io-net loads
the driver properly, but crashes on the first call into the c++ library. The
call is contained within an extern “C” block:
filter.c*
Initialize(“String”);
lib.h file
#ifdef __cplusplus
extern “C”
{
#endif // __cplusplus
int Initialize(const char *pszModulePathName);
void Terminate();
#ifdef __cplusplus
}
#endif // __cplusplus
lib.c file*
int Initialize(const char *pszModulePathName)
{
try
{
lib::Init::Initialize(pszModulePathName);
return 0;
}
catch(std::exception&)
{
return -1;
}
}
When all of my libs are linked in, i don’t even get to that point. Io-net
crashes when loading the driver. I am linking in a manually built version of
the openssl crypto lib, which also may be causing problems. Currently, i do
not know of a openssl crypto library that can build into a shared object and
loadable by io-net. However, i believe that the lib that i have created has
been built corectly. I am currently trying to link the libs in one-by-one and
determine where the problem exists.
Anyway, thanks for any help you could provide.
Colin Burgess wrote:
Is io-net succesfully loading the dll?
Have you wrapped your interface functions with extern “C”?
What is the call doing?
Where it dying?
Steven Erickson <> sojg@mediaone.net> > wrote:
I am trying to link a lib that contains C++ code and exception handling,
and am having some problems. The first call to the lib that contains the
C++ code crashes io-net. I
am building the lib with the -lang-c++ LD flag set. I am also setting
this
flag when building my filter.
Does anyone have any ideas?
–
cburgess@qnx.com