a command promt pops up in an MFC application

8 posts / 0 new
Last post
Offline
Last seen: 7 years 1 week ago
Joined: 03/27/2013
Posts: 28
a command promt pops up in an MFC application

Hi,

I have made a simple MFC application with visual C++, which publishes a string and subscribes to it. Everytime I run the application and the publisher and subscriber begin to function, a command promt screen pops up besides the dialog boxes of the publisher and subscriber. I wonder why it happens and if there's a way to avoid this.

rose's picture
Offline
Last seen: 3 years 5 months ago
Joined: 08/22/2011
Posts: 148

Hello Randy, 

If you are using a version of our product with a temporary license, it will show a dialog box to notify you about your license expiration.  Other than that, it should only appear when there is some type of error.  Are you seeing any message in the command prompt?

Thank you!

Rose 

Gerardo Pardo's picture
Offline
Last seen: 1 week 2 days ago
Joined: 06/02/2010
Posts: 602

Hello,

I think the command prompt is caused by our logging infrastructure that "asserts" a console where it will print any logging on error messages.

To avoid this console you need to re-direct the logging output to a file or another device. You do this calling the operation set_output_file or set_output_device on the NDDSConfigLogger singleton class.

For example:

FILE *myLogFile = fopen("my_logfile.txt", "a+");
NDDSConfigLogger::get_instance()->set_output_file(myLogFile); 

This needs to be done before you call any other operations on the RTI Connext DDS API to ensure that any output goes to the file/device instead of the standard output. 

Gerardo

Offline
Last seen: 7 years 1 week ago
Joined: 03/27/2013
Posts: 28

Hello Rose,

yes I'm using a trial version, but there are some other mesaages in addition to the license expiration info.

RTICdrStream_serializeString:!precondition: (me == ((void *)0)) || (me->_current
Position == ((void *)0)) || (maximumLength < 1) || ((in != ((void *)0)) && ((max
imumLength < 1) || (strlen(in) + 1 > maximumLength))) || ((in == ((void *)0)) &&
(maximumLength < 0))
DDS_StringPlugin_serialize:string length cannot be greater or equal than alloc s
ize
PRESWriterHistoryDriver_initializeSample:!serialize
WriterHistoryMemoryPlugin_addEntryToSessions:!initialize sample
WriterHistoryMemoryPlugin_getEntry:!add virtual sample to sessions
WriterHistoryMemoryPlugin_addSample:!get entry
PRESWriterHistoryDriver_addWrite:!add_sample
PRESPsWriter_writeInternal:!collator addWrite
Exiting...

Offline
Last seen: 7 years 1 week ago
Joined: 03/27/2013
Posts: 28

Hello,

Thank you so much for your kind assistance.
The messages that appear in the command prompt (as I have posted in last comment) do not show up when I'm running a console project. If this logging infrastructure asserts a console to print any logging on error messages, why don't these messages show up in all project types? I do not see them in a normal console rti application.

I get error mesages when using that snippet.

 

Offline
Last seen: 7 years 1 week ago
Joined: 03/27/2013
Posts: 28

 redirected the logging output to another file. The command prompt is still there, but the messages have been limited to license expiration information. 
Is there a way not to see this console at all?

rose's picture
Offline
Last seen: 3 years 5 months ago
Joined: 08/22/2011
Posts: 148

Hello RJ,

The serialize error message means that you are trying to write a longer string than is allowed by your IDL file.  Are you explicitly setting the maximum string length in your IDL file?  If you don't specify the maximum length of the strings in your IDL they will automatically be given a maximum length of 255 characters by rtiddsgen.  

You can change this default maximum when you run rtiddsgen, or you can explicitly set a max length for your string:  

struct MyMsg {

    string<512> myString;

};

Thank you!

Rose

rose's picture
Offline
Last seen: 3 years 5 months ago
Joined: 08/22/2011
Posts: 148

Hi RJ,

Answering your second question:  to remove the license expiration information from appearing in the console, you will need to contact your account team.

Rose