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

Frank Fock Frank.Fock____t-online.de
Wed Jan 22 00:03:20 CET 2003


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