Problem with typedef

Hello Dudes :),

i got a problem with my C++ Code.
I am busy with an OPC UA Client in C++. Notoriously there is only a bad documented ANSI C Api for it (free for commercial). Now i have to write a simple C++ Class to encapsulate the whole Api.

To my problem: There is a function with following prototype, which is hidden in the uastack.dll (The dll which provides the API):

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/** 
 ...
 * @param sUrl                      [in] The url of the server to connect to.
...
 */
OPCUA_EXPORT OpcUa_StatusCode OpcUa_Channel_Connect( 
    OpcUa_Channel                               hChannel,
    const OpcUa_StringA                         sUrl,
    OpcUa_Channel_PfnConnectionStateChanged*    pfCallback,
    OpcUa_Void*                                 pvCallbackData,
    OpcUa_ByteString*                           pClientCertificate,
    OpcUa_ByteString*                           pClientPrivateKey,
    OpcUa_ByteString*                           pServerCertificate,
    OpcUa_Void*                                 pPKIConfig,
    OpcUa_String*                               pRequestedSecurityPolicyUri,
    OpcUa_Int32                                 nRequestedLifetime,
    OpcUa_MessageSecurityMode                   messageSecurityMode,
    OpcUa_ChannelSecurityToken**                ppSecurityToken,
    OpcUa_UInt32                                nNetworkTimeout);


You can ignore the most of this shit :). There is only a problem with the Parameter 2:
const OpcUa_StringA sUrl

The OpcUa_StringA is a typedef of an OpcUa_CharA*. OpcUa_CharA is again a simple typedef of char. See here:

1
2
3
4
5
...
typedef char                OpcUa_CharA;
typedef unsigned char       OpcUa_UCharA;
typedef OpcUa_CharA*        OpcUa_StringA;
...


So far so good.
Now i got my own typedef of a char in another header:

1
2
3
...
typedef char L_CHARACTER;
...


Sorry for the lenght of my posting. The problem is following Compilererror:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
COpcUaStatusCode COpcUaChannel::connectChannel(const L_CHARACTER* sUrl)
{
...
uStatus = OpcUa_Channel_Connect(m_pChannel, 
                              sUrl, 
                              pfnUaServer_ClientChannelConnectionStateChanged, 
                              &m_uCallbackData, &tClientCertificate,
                              &tClientPrivateKey, 
                              &tServerCertificate, 
                              &tPkiConfig, 
                              pSecurityPolicy, 
                              0, OpcUa_MessageSecurityMode_None,
                              &m_ptSecurityToken, 
                              OPCUA_INFINITE); 
...
}


CompilerError (German):
error C2664: 'OpcUa_Channel_Connect': Konvertierung des Parameters 2 von 'const L_CHARACTER *' in 'const OpcUa_StringA' nicht möglich

CompilerError (English - Selftranslated):
error C2664: 'OpcUa_Channel_Connect': Converting of parameter 2 from 'const L_CHARACTER *' in 'const OpcUa_StringA' not possible

But that ist the fucking same Type... cause char*

I hope you can help me.
Last edited on
I think i got the Problem.
It coheres with the const keyword in
const L_CHARACTER* sUrl

When i take out it, it works.
const OpcUa_StringA === OpcUa_CharA* const =\= const OpcUa_CharA*
Topic archived. No new replies allowed.