471,338 Members | 1,308 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,338 software developers and data experts.

Using tlb/dll on Windows (VARIANT data type returned)

I have C++ code to import a .tlb and use a .dll that has functions that return VARIANT types and accepts BSTRs (bstrings). I have seen that python has modules that can manipulate VARIANTs and BSTRs in the win32com or comtypes.automation packages. I began to use Boost.Python to script some of my code. I tried to send the VARIANT back to python by having the extension module's functions return a VARIANT or VARIANT*; I even tried _variant_t. In python, I used the comtypes.automation.VARIANT type like so:
varvalue = VARIANT(cppextension.function_call())
But this did not work :(

Qs:
Can I return the VARIANT using Boost.Python?
If not, is there another way?
Also, how can I use the tlb/dll directly in python? Is it similar to in C++, where I import the tlb and then can access the dll's namespace?

Any help would be appreciated!
Dec 2 '07 #1
1 3000
bartonc
6,596 Expert 4TB
I have C++ code to import a .tlb and use a .dll that has functions that return VARIANT types and accepts BSTRs (bstrings). I have seen that python has modules that can manipulate VARIANTs and BSTRs in the win32com or comtypes.automation packages. I began to use Boost.Python to script some of my code. I tried to send the VARIANT back to python by having the extension module's functions return a VARIANT or VARIANT*; I even tried _variant_t. In python, I used the comtypes.automation.VARIANT type like so:
varvalue = VARIANT(cppextension.function_call())
But this did not work :(

Qs:
Can I return the VARIANT using Boost.Python?
If not, is there another way?
Also, how can I use the tlb/dll directly in python? Is it similar to in C++, where I import the tlb and then can access the dll's namespace?

Any help would be appreciated!
The win32 package has support for this type of conversion. The comtypes module (package?) may also have what you are looking for.
Dec 4 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

6 posts views Thread by David Hoffer | last post: by
6 posts views Thread by Serkan DIRIARIN | last post: by
2 posts views Thread by empire5 | last post: by
3 posts views Thread by jacob navia | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.