Home
Support

Knowledge Base

BSPs and drivers
Community resources
Product documentation
Questions?
Contact us

ApModuleFunction() problem with C++
 
________________________________________________________________________

Applicable Environment
________________________________________________________________________
  • Topic: ApModuleFunction() problem with C++
  • SDP: 6.4.1
  • Host: Any supported host
________________________________________________________________________

Issue
________________________________________________________________________

 C++ compiler complains about ApModuleFunction() setup function declaration. The error looks like

button.cpp:16: error: ISO C++ forbids declaration of 'setup_module' with no type
button.cpp: In function 'int button(PtWidget_t*, ApInfo_t*, PtCallbackInfo_t*)':
button.cpp:32: error: invalid conversion from 'int (*)(PtWidget_t*, ApInfo_t*, PtCallbackInfo_t
*)' to 'int (*)()'
button.cpp:32: error: initializing argument 2 of 'void ApModuleFunction(ApEventLink_t*, int (
*)(), int)'
cc: /usr/qnx641/host/qnx6/x86/usr/lib/gcc/i386-pc-nto-qnx6.4.0/4.3.3/cc1plus error 1

However, the function has been declared correctly:
setup_module( PtWidget_t *widget, ApInfo_t *apinfo, PtCallbackInfo_t *cbinfo )

________________________________________________________________________

Recommendation
________________________________________________________________________

The C++ compiler has a more strict function parameter checking.
Use the C compiler instead. Rename button.cpp to button.c.

________________________________________________________________________
NOTE: This entry has been validated against the SDP version listed above. Use caution when considering this advice for any other SDP version. For supported releases, please reach out to QNX Technical Support if you have any questions/concerns.
________________________________________________________________________


Related Attachments
 None Found





Please contact us with your questions or concerns.