OpenQNX :: The QNX Community Portal

Jul 19, 2008 - 03:27 PM
Google
  Web openqnx.com   
     Create an account Home · Submit News · QNX Forums · QNX Download · Search   
_
Main Menu
Who's Online
There are 38 unlogged users and 1 registered user online.

You can log-in or register for a user account here.

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
smadhavi
26 Post subject: Problem with msgget(......  PostPosted: 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
 
 View user's profile Send private message  
Reply with quote Back to top
micro
Post subject: RE: Problem with msgget(......  PostPosted: 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.
 
 View user's profile Send private message  
Reply with quote Back to top
mario
Post subject: RE: Problem with msgget(......  PostPosted: Jan 24, 2008 - 01:18 PM
QNX Master


Joined: Sep 01, 2002
Posts: 2773

Or the prototypes aren't complete.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
smadhavi
Post subject: RE: Problem with msgget(......  PostPosted: 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
 
 View user's profile Send private message  
Reply with quote Back to top
micro
Post subject: RE: Problem with msgget(......  PostPosted: 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
 
 View user's profile Send private message  
Reply with quote Back to top
rgallen
Post subject: Re: RE: Problem with msgget(......  PostPosted: 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 Smile
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
cburgess
Post subject: RE: Re: RE: Problem with msgget(......  PostPosted: Jan 26, 2008 - 12:40 PM
QNX Master


Joined: Aug 31, 2004
Posts: 180
Location: Ottawa
BTW - QNX doesn't support SYSV IPC calls...
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
smadhavi
Post subject:   PostPosted: 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
 
 View user's profile Send private message  
Reply with quote Back to top
ianc
Post subject:   PostPosted: 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
 
 View user's profile Send private message  
Reply with quote Back to top
smadhavi
Post subject:   PostPosted: 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?
 
 View user's profile Send private message  
Reply with quote Back to top
mario
Post subject:   PostPosted: 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 Wink
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
rgallen
Post subject:   PostPosted: 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...
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
rgallen
Post subject:   PostPosted: 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.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2007 The PNphpBB Group
Credits
All logos and trademarks in this site are property of their respective owners. The comments are property of their posters.
Powered by OpenQNX: The QNX Community Portal Site
QNX and the QNX logo are registered trademarks of QNX Software Systems.