Closed fresh-ji closed 4 years ago
@fresh-ji looking at your code this would be expected behavior. You only create a domain allocated to a local variable dp and then your function returns resulting in the domain running out of scope and terminating itself. Please look at the Isocpp2 documentation for more information on how it works.
i am sorry that i did not express myself clearly, but the application really terminates unnormally.
i executed it in PowerShell. You can see that "that point" did not printed.
Today i reconsidered it again, i noticed that "#include
thanks!
@fresh-ji I think what you seeing is the termination behavior of OpenSplice. When the domain participant runs out of scope it will be cleaned up and when the last domain participant is gone the application will be terminated with an exit call resulting in termination of your application. To prevent this you could keep a global reference to the dp variable resulting in OpenSplice not terminating.
But in fact i did not do anything else in my application, whatever i write behind "dds::domain::DomainParticipant dp(org::opensplice::domain::default_id());" can not be reached. So i think the domain participant could not run out of scope.
i looked over #99 https://github.com/ADLINK-IST/opensplice/issues/99 and i think the problems may be the same.
when i doing this process not in dll-way, everything goes right; and i add "#include
Now if i want to package the dds-api into dll and invoke it in pure-C environment, what is the right way to do without using "#include
@fresh-ji To compile an isocpp2 application on windows please see this One of the steps is that any include file from OpenSplice should be done before including Windows.h to avoid memory heap crashes.
very appreciate for your answer. putting Windows.h backwards could make the non-dll application run correctly. but i use "LoadLibrary" to load dll, which do not use any include file from OpenSplice, only Windows.h, so the problem is still exists. i am going to reconsider the framework to avoid it. Thanks!
Here is my anothor confusion. when i run my another application, the publisher writes messages every one second, the subscriber takes them and shows in console, for total 19 messages. But everytime the subscriber receives the first message two times("initederate"), you can see from the figure, at 0.00 and 0.06. i am for sure my "initederate" sends only once, how the second message been received? at last of figure, the "letusendit" also receives twice, which was sent only once. thanks for looking through this.
@fresh-ji what code are you using to read the samples? Are you using read or take?
i am using “take”
@Johnnyxy at https://github.com/ADLINK-IST/opensplice/issues/99 has solved my issue perfectly. Thanks for everyone.
Hi, recently i have been learning the isocpp2-API-based examples in PXXX-VortexOpenSplice-6.9.181018OSS-HDE-x86_64.win-vs2017-installer. I built my own dll-based application, but the dds-related sentences can not be executed. Full codes provided below:
dll header
dll source
main
everytime the program enters dll corretly, when executing "dds::domain::DomainParticipant dp(org::opensplice::domain::default_id());", the cmd window pauses for a few seconds and shuts itself down, nothing else happen.
sorry to disturb you, but i am very confused about this.
thanks.