How to declare nested templates in idl 3.0
I have what I hope is a basic question, but I've been unsuccessful finding any documentation or examples on MSDN or the internet in general.
I'm implementing a windows runtime component in C++/WinRT. I have an asynchronous method that scans for the presence of a specific type of device and returns a vector of strings (device IDs) of devices found. The C++ signature of the function is:
static IAsyncOperation<IVector<winrt::hstring>> ScanInterfacesAsync();
I have been unsuccessful in getting an authoring an IDL that projects this function to the runtime. My best guess:
static IAsyncOperation<IVector<String>> ScanInterfacesAsync();
Fails with an error:
error MIDL2025: [msg]syntax error [context]: expecting > or , near ">>"
I've tried a few other things but I can tell I just fundamentally don't understand how IDL works with templates. And I can't find any examples of a templated return type in any of the online IDL documentation.
Is this possible? What's the right syntax? Any pointers to documentation I've overlooked? Thanks.
uwp windows-runtime midl c++-winrt
add a comment |
I have what I hope is a basic question, but I've been unsuccessful finding any documentation or examples on MSDN or the internet in general.
I'm implementing a windows runtime component in C++/WinRT. I have an asynchronous method that scans for the presence of a specific type of device and returns a vector of strings (device IDs) of devices found. The C++ signature of the function is:
static IAsyncOperation<IVector<winrt::hstring>> ScanInterfacesAsync();
I have been unsuccessful in getting an authoring an IDL that projects this function to the runtime. My best guess:
static IAsyncOperation<IVector<String>> ScanInterfacesAsync();
Fails with an error:
error MIDL2025: [msg]syntax error [context]: expecting > or , near ">>"
I've tried a few other things but I can tell I just fundamentally don't understand how IDL works with templates. And I can't find any examples of a templated return type in any of the online IDL documentation.
Is this possible? What's the right syntax? Any pointers to documentation I've overlooked? Thanks.
uwp windows-runtime midl c++-winrt
add a comment |
I have what I hope is a basic question, but I've been unsuccessful finding any documentation or examples on MSDN or the internet in general.
I'm implementing a windows runtime component in C++/WinRT. I have an asynchronous method that scans for the presence of a specific type of device and returns a vector of strings (device IDs) of devices found. The C++ signature of the function is:
static IAsyncOperation<IVector<winrt::hstring>> ScanInterfacesAsync();
I have been unsuccessful in getting an authoring an IDL that projects this function to the runtime. My best guess:
static IAsyncOperation<IVector<String>> ScanInterfacesAsync();
Fails with an error:
error MIDL2025: [msg]syntax error [context]: expecting > or , near ">>"
I've tried a few other things but I can tell I just fundamentally don't understand how IDL works with templates. And I can't find any examples of a templated return type in any of the online IDL documentation.
Is this possible? What's the right syntax? Any pointers to documentation I've overlooked? Thanks.
uwp windows-runtime midl c++-winrt
I have what I hope is a basic question, but I've been unsuccessful finding any documentation or examples on MSDN or the internet in general.
I'm implementing a windows runtime component in C++/WinRT. I have an asynchronous method that scans for the presence of a specific type of device and returns a vector of strings (device IDs) of devices found. The C++ signature of the function is:
static IAsyncOperation<IVector<winrt::hstring>> ScanInterfacesAsync();
I have been unsuccessful in getting an authoring an IDL that projects this function to the runtime. My best guess:
static IAsyncOperation<IVector<String>> ScanInterfacesAsync();
Fails with an error:
error MIDL2025: [msg]syntax error [context]: expecting > or , near ">>"
I've tried a few other things but I can tell I just fundamentally don't understand how IDL works with templates. And I can't find any examples of a templated return type in any of the online IDL documentation.
Is this possible? What's the right syntax? Any pointers to documentation I've overlooked? Thanks.
uwp windows-runtime midl c++-winrt
uwp windows-runtime midl c++-winrt
edited Dec 11 '18 at 7:26
Jackhuang
71
71
asked Nov 28 '18 at 11:56
Sean KellySean Kelly
256
256
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The error message seems to indicate, that MIDL 3.0 uses a greedy parser. It interprets the two consecutive closing angle brackets (>) as a single right-shift operator (>>), much like C++ did prior to C++11 (see right angle bracket).
To work around this, MIDL 3.0 source needs to introduce arbitrary whitespace (e.g. a single space character) in between consecutive closing angle brackets so that it gets interpreted as two distinct tokens as opposed to a single token. The following should compile:
static IAsyncOperation<IVector<String> > ScanInterfacesAsync();
Hah, yes, that did the trick. I swear I tried that earlier, but I had some other typename problems that I think I only cleared up afterward. Either way, works now. Thanks.
– Sean Kelly
Nov 29 '18 at 15:56
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53518922%2fhow-to-declare-nested-templates-in-idl-3-0%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The error message seems to indicate, that MIDL 3.0 uses a greedy parser. It interprets the two consecutive closing angle brackets (>) as a single right-shift operator (>>), much like C++ did prior to C++11 (see right angle bracket).
To work around this, MIDL 3.0 source needs to introduce arbitrary whitespace (e.g. a single space character) in between consecutive closing angle brackets so that it gets interpreted as two distinct tokens as opposed to a single token. The following should compile:
static IAsyncOperation<IVector<String> > ScanInterfacesAsync();
Hah, yes, that did the trick. I swear I tried that earlier, but I had some other typename problems that I think I only cleared up afterward. Either way, works now. Thanks.
– Sean Kelly
Nov 29 '18 at 15:56
add a comment |
The error message seems to indicate, that MIDL 3.0 uses a greedy parser. It interprets the two consecutive closing angle brackets (>) as a single right-shift operator (>>), much like C++ did prior to C++11 (see right angle bracket).
To work around this, MIDL 3.0 source needs to introduce arbitrary whitespace (e.g. a single space character) in between consecutive closing angle brackets so that it gets interpreted as two distinct tokens as opposed to a single token. The following should compile:
static IAsyncOperation<IVector<String> > ScanInterfacesAsync();
Hah, yes, that did the trick. I swear I tried that earlier, but I had some other typename problems that I think I only cleared up afterward. Either way, works now. Thanks.
– Sean Kelly
Nov 29 '18 at 15:56
add a comment |
The error message seems to indicate, that MIDL 3.0 uses a greedy parser. It interprets the two consecutive closing angle brackets (>) as a single right-shift operator (>>), much like C++ did prior to C++11 (see right angle bracket).
To work around this, MIDL 3.0 source needs to introduce arbitrary whitespace (e.g. a single space character) in between consecutive closing angle brackets so that it gets interpreted as two distinct tokens as opposed to a single token. The following should compile:
static IAsyncOperation<IVector<String> > ScanInterfacesAsync();
The error message seems to indicate, that MIDL 3.0 uses a greedy parser. It interprets the two consecutive closing angle brackets (>) as a single right-shift operator (>>), much like C++ did prior to C++11 (see right angle bracket).
To work around this, MIDL 3.0 source needs to introduce arbitrary whitespace (e.g. a single space character) in between consecutive closing angle brackets so that it gets interpreted as two distinct tokens as opposed to a single token. The following should compile:
static IAsyncOperation<IVector<String> > ScanInterfacesAsync();
answered Nov 29 '18 at 12:59
IInspectableIInspectable
26.3k54498
26.3k54498
Hah, yes, that did the trick. I swear I tried that earlier, but I had some other typename problems that I think I only cleared up afterward. Either way, works now. Thanks.
– Sean Kelly
Nov 29 '18 at 15:56
add a comment |
Hah, yes, that did the trick. I swear I tried that earlier, but I had some other typename problems that I think I only cleared up afterward. Either way, works now. Thanks.
– Sean Kelly
Nov 29 '18 at 15:56
Hah, yes, that did the trick. I swear I tried that earlier, but I had some other typename problems that I think I only cleared up afterward. Either way, works now. Thanks.
– Sean Kelly
Nov 29 '18 at 15:56
Hah, yes, that did the trick. I swear I tried that earlier, but I had some other typename problems that I think I only cleared up afterward. Either way, works now. Thanks.
– Sean Kelly
Nov 29 '18 at 15:56
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53518922%2fhow-to-declare-nested-templates-in-idl-3-0%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown