ErichS
Hopefully this doesn't confuse things too much, but let me convert to using the real names of the libraries and functions to better explain the linker complaint. This is all specific to ThreadX by Microsoft.
In my C++ class header, I include the primary library (tx_api.h) and the non-primary library (ux_api.h):
extern "C"
{
#include "tx_api.h" // Included for other sections of the class that are working
#include "ux_api.h"
}
In my C++ class, I try to initialize the UX device. (I replaced all of the typical references and pointer with forced constants to ensure that I was providing legit, known data.)
ux_system_initialize(( VOID *) 0x81B00000,
0x19000,
UX_NULL,
0);
In the ux_api.h, the function name is converted based upon preprocessor, program specific definitions. (Note, this file has the extern __cplusplus block around the entire file.) This is also the location for the library's reference to tx_api.h
#define ux_system_initialize _ux_system_initialize
/* Include ThreadX API include file. */
#include "tx_api.h"
The function _ux_system_initialize is found in ux_system_initialize.c and it is the only function in the file.
#include "ux_api.h"
UINT _ux_system_initialize(VOID *regular_memory_pool_start, ULONG regular_memory_size,
VOID *cache_safe_memory_pool_start, ULONG cache_safe_memory_size)
{
/* Some Code */
/* Create the Mutex object used by USBX to control critical sections. */
status = _ux_utility_mutex_create(&_ux_system -> ux_system_mutex, "ux_system_mutex");
/* Little More Code */
}
The function _ux_utility_mutex_create is found in ux_utility_mutex_create.c and is the only function in the file.
#include "ux_api.h"
UINT _ux_utility_mutex_create(TX_MUTEX *mutex, CHAR *mutex_name)
{
UINT status;
/* Call ThreadX to create the Mutex object. */
status = tx_mutex_create(mutex, (CHAR *) mutex_name, TX_NO_INHERIT);
/* Some Code */
}
This is where the error is generated:
../..\ux\Debug\libux.a(ux_utility_mutex_create.o): in function `_ux_utility_mutex_create':
undefined reference to `_txe_mutex_create'
Located inside tx_api.h, the function name is converted based upon preprocessor, program specific definitions. (Note, this file has the extern __cplusplus block around the entire file.)
#define tx_mutex_create(m,n,i) _txe_mutex_create((m),(n),(i),(sizeof(TX_MUTEX)))
The function _txe_mutex_create is located in file txe_mutex_create.c and is the only function in the file
#include "tx_api.h"
UINT _txe_mutex_create(TX_MUTEX *mutex_ptr, CHAR *name_ptr, UINT inherit, UINT mutex_control_block_size)
{
/* Some Code */
}
Per my previous post, the library for TX properly shows the _txe_mutex_create function and the preprocessors commands are all defaulted and pointing to the correct macros.