Page 1 of 2

Updating SNMP for v3.x Project

Posted: Thu Nov 17, 2022 2:01 pm
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

Re: Updating SNMP for v3.x Project

Posted: Thu Nov 17, 2022 2:20 pm
by SeeCwriter
Actually, my idea is not going to work. What do you suggest?

Re: Updating SNMP for v3.x Project

Posted: Fri Nov 18, 2022 11:39 am
by TomNB
Who's SNMP package are you using?

Re: Updating SNMP for v3.x Project

Posted: Fri Nov 18, 2022 1:40 pm
by SeeCwriter
DMH Software.

Re: Updating SNMP for v3.x Project

Posted: Fri Nov 18, 2022 3:22 pm
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.

Re: Updating SNMP for v3.x Project

Posted: Sat Nov 19, 2022 9:34 pm
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.

Re: Updating SNMP for v3.x Project

Posted: Mon Nov 21, 2022 4:38 am
by pbreed
udef.h is not one of ours...

Re: Updating SNMP for v3.x Project

Posted: Mon Nov 28, 2022 9:09 am
by SeeCwriter
Sorry, I misspelled the file name. It's udefs.h, located in nburn\nbrtos\include\file.

Re: Updating SNMP for v3.x Project

Posted: Wed Nov 30, 2022 12:50 pm
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:

Re: Updating SNMP for v3.x Project

Posted: Wed Nov 30, 2022 2:34 pm
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.