| | |
c and shared libs ?? how to do it right?
![]() |
•
•
Join Date: Feb 2006
Posts: 9
Reputation:
Solved Threads: 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.
<code>
void
initRv( tibrvTransport *transport)
{
char* serviceStr = "7500";
char* networkStr = "";
char* daemonStr = "tcp:7500";
status = tibrvTransport_Create(*transport, serviceStr, networkStr, daemonStr);
return;
}
<\code>
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.??
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.
<code>
void
initRv( tibrvTransport *transport)
{
char* serviceStr = "7500";
char* networkStr = "";
char* daemonStr = "tcp:7500";
status = tibrvTransport_Create(*transport, serviceStr, networkStr, daemonStr);
return;
}
<\code>
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.??
•
•
Join Date: May 2004
Posts: 177
Reputation:
Solved Threads: 10
try
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.
It's possible *transport was actually correct, but the compiler does not seem to know.
C Syntax (Toggle Plain Text)
status = tibrvTransport_Create(transport, serviceStr, networkStr, daemonStr);
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.
C Syntax (Toggle Plain Text)
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.
![]() |
Similar Threads
- Installing Software (*nix Software)
- FrontPage98 help with shared borders (HTML and CSS)
- fopen: No such file or directory (*nix Software)
- Set Permissions for Shared Files and Folders (Windows tips 'n' tweaks)
Other Threads in the C Forum
- Previous Thread: Pointer arithmetic homework question
- Next Thread: pls help me to convert char to integer.
| Thread Tools | Search this Thread |
* adobe ansi api array binarysearch centimeter changingto char character cm convert copyanyfile copypdffile cprogramme createcopyoffile createprocess() csyntax database directory feet fflush fgets file floatingpointvalidation fork frequency givemetehcodez global grade gtkgcurlcompiling gtkwinlinux highest histogram homework i/o inches infiniteloop input interest intmain() iso keyboard kilometer km linked linkedlist linux linuxsegmentationfault list locate looping lowest match meter microsoft mqqueue mysql oddnumber odf open opendocumentformat openwebfoundation owf pattern pdf performance posix power probleminc program programming pyramidusingturboccodes read recv recvblocked repetition reversing scanf scheduling segmentationfault send single socket socketprograming socketprogramming stack standard string suggestions systemcall unix urboc user voidmain() wab whythiscodecausesegmentationfault win32api windows.h windowsapi





