Updating SNMP for v3.x Project

Discussion to talk about software related topics only.
SeeCwriter
Posts: 624
Joined: Mon May 12, 2008 10:55 am

Updating SNMP for v3.x Project

Post by SeeCwriter »

I'm upgrading SNMP used in projects built with v2.x tools to work in projects built with v3.x tools. The SNMP files are C files. During compilation header file <file/udefs.h> is included, which throws an error:

C:/nburn/nbrtos/include/file/udefs.h:35:8: error: expected identifier or '(' before string constant
extern "C++"

The error is caused by statement "extern "C++" at the top of the file, line 35:

Code: Select all

#ifndef NB_BARE_METAL
extern "C++"
{
#include <nbrtos.h>
}
#endif
The same file in the v2.x tools only has this statement at the top of the file:

Code: Select all

#ifdef __cplusplus
extern "C" {
#endif
Would this change to the v3.x file work:

Code: Select all

#if !defined( NB_BARE_METAL ) && !defined( __cplusplus )
extern "C++"
{
#include <nbrtos.h>
}
#endif
SeeCwriter
Posts: 624
Joined: Mon May 12, 2008 10:55 am

Re: Updating SNMP for v3.x Project

Post by SeeCwriter »

Actually, my idea is not going to work. What do you suggest?
User avatar
TomNB
Posts: 576
Joined: Tue May 10, 2016 8:22 am

Re: Updating SNMP for v3.x Project

Post by TomNB »

Who's SNMP package are you using?
SeeCwriter
Posts: 624
Joined: Mon May 12, 2008 10:55 am

Re: Updating SNMP for v3.x Project

Post by SeeCwriter »

DMH Software.
User avatar
TomNB
Posts: 576
Joined: Tue May 10, 2016 8:22 am

Re: Updating SNMP for v3.x Project

Post by TomNB »

The do have a port to our 3.x platform. However, we do not have their code or do the integration here. Have you tried contacting them? I have not seen extern commands like that before.
SeeCwriter
Posts: 624
Joined: Mon May 12, 2008 10:55 am

Re: Updating SNMP for v3.x Project

Post by SeeCwriter »

I'm not sure what you mean when you say "I have not seen extern commands like that before." They are in your file. undef.h is not a DMH file.
The DMH implementation of SNMP saves configuration data to the module's flash memory. So it includes the headers for being able to use the fs_ functions.
I've contacted DMH about this and they are looking into it also.
User avatar
pbreed
Posts: 1088
Joined: Thu Apr 24, 2008 3:58 pm

Re: Updating SNMP for v3.x Project

Post by pbreed »

udef.h is not one of ours...
SeeCwriter
Posts: 624
Joined: Mon May 12, 2008 10:55 am

Re: Updating SNMP for v3.x Project

Post by SeeCwriter »

Sorry, I misspelled the file name. It's udefs.h, located in nburn\nbrtos\include\file.
User avatar
TomNB
Posts: 576
Joined: Tue May 10, 2016 8:22 am

Re: Updating SNMP for v3.x Project

Post by TomNB »

That must be put in there by the DMH installer, it is not one of our files. Here is a pic of the directory of a standard 3.x install:
Attachments
Screenshot 2022-11-30 125034.jpg
Screenshot 2022-11-30 125034.jpg (30.19 KiB) Viewed 8241 times
SeeCwriter
Posts: 624
Joined: Mon May 12, 2008 10:55 am

Re: Updating SNMP for v3.x Project

Post by SeeCwriter »

I should have paid attention to file header, it's actually a file from HCC Embedded. The file is in subdirectory of nbrtos\include\file. I think it must installed when NNDK is installed.

It's only included in four files from HCC Embedded: api_f.h, fsf.h, fsm.h, port_s.h. And DMH includes file fsf.h when it needs to use the Flash memory on the module to store SNMP configuration data.

At one point I thought I could just edit udefs.h to remove the "extern c++" term at the top, but later in the file it defines a mutex type as OS_CRIT, but OS_CRIT uses classes, which won't work when compiling a C file, which is what all DMH files are. In v2.9.5 of the tools, udefs.h defines the mutex as an unsigned long.
Post Reply