0

Hey, I am a newbie to all of this so please don't flame me for a stupid question. I am trying to write a shared lib that will initialize a connection to a messaging deamon. Then the library will be called at intervals and send data. My problem is that I am having issues with passing a datatype to a lib. I would think that the following would work.

void
initRv( tibrvTransport *transport)
{
        char*               serviceStr = "7500";
    char*               networkStr = "";
    char*               daemonStr  = "tcp:7500";

    status = tibrvTransport_Create(*transport, serviceStr, networkStr, daemonStr);
return;
}

Give me a warning: passing arg 1 of tibrvTransport_Create makes pointer from integer without a cast

I think I have the pointers screwed up.??

Edited by happygeek: fixed formatting

2
Contributors
2
Replies
3
Views
11 Years
Discussion Span
Last Post by crusty_collins
0

try

status = tibrvTransport_Create(transport, serviceStr, networkStr, daemonStr);

transport is already a pointer, so using *transport says to pass that value of the object pointed to, not the address. Pointers are addresses.

It also seems you are not prototyping functions. Or maybe not including header files.

There should be separate prototypes for each of the functions so that compiler won't issue a warning, instead it will issue a fatal error if the datatype of an argument is wrong.

I made up this prototype:
void tibrvTransport_Create(tibrvTransport *, char *, char *, char *);

It's possible *transport was actually correct, but the compiler does not seem to know.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.