| Author |
Message |
|
|
|
Post subject: Problem with msgget(......
Posted: Jan 24, 2008 - 05:33 AM
|
|
New Member
Joined: Jan 24, 2008
Posts: 4
|
|
Dear all,
I am new to QNX Nuetrino...
I am just trying to compile some progs using IPC
but when i am compiling the code which has msgget syscall
i got the following error
implicit declaration of function `int msgget(...)'
implicit declaration of function `int msgsnd(...)'
I have included the msg.h file
anybody can help
Thanks
Madhavi |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Problem with msgget(......
Posted: Jan 24, 2008 - 10:17 AM
|
|
Senior Member
Joined: Jul 22, 2004
Posts: 327
|
|
your prototypes are not read before the function is used.
Prototype your functions AND structures on the beginning of the file helps. |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Problem with msgget(......
Posted: Jan 24, 2008 - 01:18 PM
|
|
QNX Master
Joined: Sep 01, 2002
Posts: 2773
|
|
| Or the prototypes aren't complete. |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Problem with msgget(......
Posted: Jan 25, 2008 - 04:48 AM
|
|
New Member
Joined: Jan 24, 2008
Posts: 4
|
|
Hi,
Thx for ur suggesion
but i have already written th eprototypes also
here is my code
#include <iostream>
using namespace std;
#include <sys/ipc.h>
#include <sys/stat.h>
#include <sys/types.h>
#define MSG_KEY (key_t)1097
extern int msgget(key_t __key, int __msgflg);
int main()
{
cout << "hello world" << endl;
key_t key = MSG_KEY ;
int msgflg = IPC_CREAT;
int queueid = msgget(key, msgflg);
if(queueid == -1){
cout << "msg Q creation failed" << endl;
exit(1);
}else{
cout << "msg Q creatd" << endl;
}
exit(0);
}
Thanks
Madhu |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Problem with msgget(......
Posted: Jan 25, 2008 - 10:54 AM
|
|
Senior Member
Joined: Jul 22, 2004
Posts: 327
|
|
remove the extern keyword, you put extern if you want your function/variable to be read externally, not if you want to use a external defined function.
You say:
My function msgget(bla, blubb); should be able to be read by other sources.
You want:
My app wants to read the function called msgget(); from another source.
So you should be fine without the extern keyword and a later linking to the library the function is in |
|
|
| |
|
|
|
 |
|
|
Post subject: Re: RE: Problem with msgget(......
Posted: Jan 25, 2008 - 08:59 PM
|
|
QNX Master
Joined: Jul 11, 2002
Posts: 600
|
|
|
smadhavi wrote:
extern int msgget(key_t __key, int __msgflg);
Perhaps you meant to type:
Code:
extern "C" {
int msgget(key_t __key, int __msgflg);
}
... since you are apparently compiling C++ in this case; and you haven't stated the linkage properties of the source file, but perhaps that is written in 'C' (a lot of stuff is written in C these days  |
|
|
| |
|
|
|
 |
|
|
Post subject: RE: Re: RE: Problem with msgget(......
Posted: Jan 26, 2008 - 12:40 PM
|
|
QNX Master
Joined: Aug 31, 2004
Posts: 180
Location: Ottawa
|
|
| BTW - QNX doesn't support SYSV IPC calls... |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jan 29, 2008 - 05:28 AM
|
|
New Member
Joined: Jan 24, 2008
Posts: 4
|
|
Hi,
i have tried without extren also no use
i think as u people said
QNX DOEN'T SUPPORT SYS VS IPC calls is Right
need to add nuetrino.h and apis related to that we have to use for IPC
But personally i feel that it should support posix statndrad SYSVs IPC Calls
as it is based on Unix
Thanks Guys
Madhavi |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jan 29, 2008 - 08:18 AM
|
|
Active Member
Joined: Jan 22, 2003
Posts: 32
Location: Bendigo, Australia
|
|
| No, it's not based on Unix. QNX is POSIX compliant, that doesn't mean it's Unix |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jan 29, 2008 - 12:07 PM
|
|
New Member
Joined: Jan 24, 2008
Posts: 4
|
|
Sry exactly what i mean is that
its a POSIX Complaint and should wrk POSIX standard APIs isn't it? |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jan 29, 2008 - 12:51 PM
|
|
QNX Master
Joined: Sep 01, 2002
Posts: 2773
|
|
There are many POSIX level. That being said I'm not sure if SYS VS IPC are POSIX at all. If they were, why would they be call SYS VS  |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jan 30, 2008 - 02:08 AM
|
|
QNX Master
Joined: Jul 11, 2002
Posts: 600
|
|
|
smadhavi wrote:
Sry exactly what i mean is that
its a POSIX Complaint and should wrk POSIX standard APIs isn't it?
Sys V IPC is not Posix... |
|
|
| |
|
|
|
 |
|
|
Post subject:
Posted: Jan 30, 2008 - 02:11 AM
|
|
QNX Master
Joined: Jul 11, 2002
Posts: 600
|
|
|
smadhavi wrote:
QNX DOEN'T SUPPORT SYS VS IPC calls is Right
Well of course he's right. No one ever said that QNX does support Sys V IPC. |
|
|
| |
|
|
|
 |
|
|