I have a function:
void GetStringValues(std::string& result, std::string& property)
that fills values "result" and "property".
How can I call this function using VOLE?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I'm not able to understand what you're doing clearly enough from the information you've given.
VOLE drives COM Automation servers from C++; from your post it seems you're trying to drive a C++ function, which you can obviously just call directly from C++.
If you post a fuller question, I'm sure we can answer.
Matt
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello again.
I'm trying to convert my code from COM to VOLE
Original I have:
MyClass* mClass = new MyClass();
…..
std::string result, property;
mClass->GetStringValues(result, property);
std::cout<<result<<std::endl<<property;
Now, if I write
object *mClass = ….
….
mClass->invoke_method_v(L"GetStringValues", &result, &property);
it will not work as it was supposed.
So my question is how to do it correct.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry, but the code sample you've given is still just plain-old-C++. It's insufficient to make a guess from that to what you're really doing. Can you provide some actual COM code that we can discuss?
Matt
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Unfortunately, I am pretty snowed with multiple commercial commitments at the moment, some of which will, thankfully, soon be complete.
It all depends on your timescales. But if you can't/don't want to wait, your options boil down to:
* engaging me to write a proprietary extension for your exclusive use
* sponsor the development of the new feature to the library
* contribute the new feature
Either of the first two will, of course, move you (close) to the head of my work queue. The third will, equally obviously, require a lot of work from you.
I apologise that I can't be more FOSS at this point, but I'm just too busy.
All the best
Matt
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've been giving it some thought, and doing some experimentation, and it seems that the reason I'd never known of out / in-out parameters being supported by type-library marshalling is that they're not. They are not, therefore, available to late-binding clients (except, perhaps, where custom marshalling is implemented), such as VBScript, Ruby, and VOLE.
Assume a class implementing this interface, that changes each of the out/in-out parameters. If you connect a class exposing this interface via early binding, such as VB or C++, then you can indeed see the changed values. However, if you connect via VBS, Ruby or VOLE, only the changes can be seen, and that's via the special treatment of by Automation.
So, in order to consider a sponsored implementation, you'd need to precisely specify what functionality you're looking for. If it's along the lines of the scenario I've described, then we might have to look beyond type-library marshalling. Once you've given me more information, I can consider (i) whether it's possible, and (ii) how much effort that might take, and therefore how much I'd be looking for sponsorship assistance.
HTH
Matt
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Sorry for the lack of response: a vacation and working on some other things (including a new version of VOLE) explain (but do not excuse) my lack of manners.
I'm very pleased to hear of your desire to sponsor new features, and interested in the challenge. However, I think we probably need to discuss your requirements in quite some detail - I suspect that the thing you're after is impossible via OLE Automation, and would require a different approach entirely - so will send you an email shortly.
Cheers
Matt
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thought I'd revisit this - is your analysis about the lat ebinding that VOLE does will still prevent an in/out return val on a call? It seems that in my project VOLE does everything else except for those few functions where I have an in/out parameter to the function.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
I have a function:
void GetStringValues(std::string& result, std::string& property)
that fills values "result" and "property".
How can I call this function using VOLE?
Hi
I'm not able to understand what you're doing clearly enough from the information you've given.
VOLE drives COM Automation servers from C++; from your post it seems you're trying to drive a C++ function, which you can obviously just call directly from C++.
If you post a fuller question, I'm sure we can answer.
Matt
Hello again.
I'm trying to convert my code from COM to VOLE
Original I have:
MyClass* mClass = new MyClass();
…..
std::string result, property;
mClass->GetStringValues(result, property);
std::cout<<result<<std::endl<<property;
Now, if I write
object *mClass = ….
….
mClass->invoke_method_v(L"GetStringValues", &result, &property);
it will not work as it was supposed.
So my question is how to do it correct.
Sorry, but the code sample you've given is still just plain-old-C++. It's insufficient to make a guess from that to what you're really doing. Can you provide some actual COM code that we can discuss?
Matt
Sorry for not making myself clear in the previous posts. Here's a bit of an actual code:
//Initialize COM Library
hResult = CoInitializeEx(NULL,COINIT_APARTMENTTHREADED);
//Create instance of core object
hResult = CoCreateInstance(CLSID_CoreAut,NULL,CLSCTX_ALL,IID_ICoreAut,(void**)&g_pCore);
//Create instnce of trade desk object
hResult = g_pCore->CreateTradeDesk(L"trader",(IDispatch**)&g_pTradeDesk);
…
VARIANT vOrderID,vDI;
hResult = g_pTradeDesk->CreateEntryOrder(bstrAccountID,bstrSymbol,bIsBuy,iLots,nPrice,nStop,nLimit,0,&vOrderID,&vDI);
The CreateEntryOrder method takes the vOrderID and vDI parameters by reference and alters their values.
Is it possible to have this method called using VOLE?
Thanks!
Ah, I see. You're after parameters.
No, alas VOLE does not (yet) support them.
Of course, now you've raised it my mind is filling with ideas …
Matt
Anything that can be done to egg on the inclusion of this? I could see a lot of value in some of my projects if VOLE allowed this.
Unfortunately, I am pretty snowed with multiple commercial commitments at the moment, some of which will, thankfully, soon be complete.
It all depends on your timescales. But if you can't/don't want to wait, your options boil down to:
* engaging me to write a proprietary extension for your exclusive use
* sponsor the development of the new feature to the library
* contribute the new feature
Either of the first two will, of course, move you (close) to the head of my work queue. The third will, equally obviously, require a lot of work from you.
I apologise that I can't be more FOSS at this point, but I'm just too busy.
All the best
Matt
How much would it cost to sponsor the development?
I've been giving it some thought, and doing some experimentation, and it seems that the reason I'd never known of out / in-out parameters being supported by type-library marshalling is that they're not. They are not, therefore, available to late-binding clients (except, perhaps, where custom marshalling is implemented), such as VBScript, Ruby, and VOLE.
Consider the following IDL:
Assume a class implementing this interface, that changes each of the out/in-out parameters. If you connect a class exposing this interface via early binding, such as VB or C++, then you can indeed see the changed values. However, if you connect via VBS, Ruby or VOLE, only the changes can be seen, and that's via the special treatment of by Automation.
So, in order to consider a sponsored implementation, you'd need to precisely specify what functionality you're looking for. If it's along the lines of the scenario I've described, then we might have to look beyond type-library marshalling. Once you've given me more information, I can consider (i) whether it's possible, and (ii) how much effort that might take, and therefore how much I'd be looking for sponsorship assistance.
HTH
Matt
Maybe I don't understand the question, but my exact scenario is above:
hResult = g_pTradeDesk->CreateEntryOrder(bstrAccountID,bstrSymbol,bIsBuy,iLots,nPrice,nStop,nLimit,0,&vOrderID,&vDI);
The CreateEntryOrder method takes the vOrderID and vDI parameters by reference and alters their values.
so basic IN/OUT ByRef on a variable - does this answer your question about specifically what I need to have happen?
Any additional information I can provide? I'd love to sponsor the development of the ability to have in/out vars.
Duncan
Sorry for the lack of response: a vacation and working on some other things (including a new version of VOLE) explain (but do not excuse) my lack of manners.
I'm very pleased to hear of your desire to sponsor new features, and interested in the challenge. However, I think we probably need to discuss your requirements in quite some detail - I suspect that the thing you're after is impossible via OLE Automation, and would require a different approach entirely - so will send you an email shortly.
Cheers
Matt
It might be - if in/out is not possible via OLE, then it likely isn't.
That's right. But it may be possible via other means. Check out the STLSoft DL library: I think it's possible that the technology used in the
could be adapted/enhanced to achieve what you're after with COM dual interfaces
Thought I'd revisit this - is your analysis about the lat ebinding that VOLE does will still prevent an in/out return val on a call? It seems that in my project VOLE does everything else except for those few functions where I have an in/out parameter to the function.