Using Agent++ and SNMP++ inside a Win32 DLL

Fernando Marotta F.Marotta____itsoftware.it
Wed Jan 22 09:16:13 CET 2003


Frank,

thank you very much for your helpful informations.
You are right, if I build the library as dll (and not .lib), it works fine,
except that I must turn off logging, otherwise I have this error:

Console_ex.obj : error LNK2001: unresolved external symbol "protected:
static class AgentLog *  DefaultLog::instance"
(?instance at DefaultLog@@1PAVAgentLog@@A)


maybe I'm missing something, anyway I'm going on to experiment with your lib

Cheers, 

Fernando

> -----Original Message-----
> From: Frank.Fock____t-online.de [mailto:Frank.Fock____t-online.de]
> Sent: mercoledì 22 gennaio 2003 0.03
> To: Fernando Marotta
> Cc: agentpp-dl____agentpp.com
> Subject: Re: Using Agent++ and SNMP++ inside a Win32 DLL
> 
> 
> Fernando,
> 
> On the following:
> 
> Fernando Marotta wrote:
> > Hi everybody,
> > 
> > I'm trying to use the agent++ and snmp++ classes inside a 
> Windows DLL (the
> > final target is to produce an extension agent for the 
> WinSNMP service, and
> > maybe use also agentx++ inside WinSNMP),
> > 
> I am working currently on a add-on lib to AGENT++
> that will provide exactly that (will focus on the
> "new" extension API for W2K/XP first)
> 
> > I've built snmp++.lib and agent++.lib files (in debug release, using
> > multithread option), and trying to write a test dll using 
> these classes,
> > this is a function I'm writing (from winsnmp specs):
> > 
> 
> > 
> > -------------------------------------------------
> > 
> > BOOL WINAPI SnmpExtensionQuery(
> >     IN BYTE                   requestType,
> >     IN OUT RFC1157VarBindList *variableBindings,
> >     OUT AsnInteger            *errorStatus,
> >     OUT AsnInteger            *errorIndex)
> > {
> > 	*errorIndex = 0;
> > 	*errorStatus = SNMP_ERRORSTATUS_NOERROR;
> > 
> > 	Vbx* pVb;
> > 
> > 	pVb = new Vbx();
> > 
> > 	return SNMPAPI_NOERROR;
> > } // end SnmpExtensionQuery()
> > 
> > -------------------------------------------------
> > 
> > 
> > 
> > even this simple code produces some errors, in particular:
> > 
> > - this obscure warning:
> > D:\Prove\SNMP\agent++\include\List.h(1353) : warning C4275: non
> > dll-interface class 'Array<class MibLeaf>' used as base for 
> dll-interface
> > class 'OrderedArray<class MibLeaf>'
> >         D:\Prove\SNMP\agent++\include\mib.h(762) : see 
> reference to class
> > template instantiation 'OrderedArray<class MibLeaf>' being compiled
> > 
> May be a template instantiation is missing here?
> 
> > - some symbol redefinitions (non-issue, symbols like 
> ASN_UNIVERSAL are
> > redefined by winsnmp, but with the same value)
> > 
> This will be fixed in SNMP++v3.2.4.
> 
> > - this errors:
> > ExtDll1.obj : error LNK2001: unresolved external symbol
> > "__declspec(dllimport) public: __thiscall Vbx::Vbx(void)"
> > (__imp_??0Vbx@@QAE at XZ)
> > 
> > (the same if I try to use a Request or Pdux object: the 
> constructors are not
> > resolved)
> > 
> 
> You build AGENT++ as static lib. But you are trying
> to import it here as a DLL. This might cause the
> problem.
> 
> Cheers,
> Frank
> 
> 



More information about the AGENTPP mailing list