如何使用 EuCOM 在 Euphoria 中创建 BSTR 的变体数组?
到目前为止,我已经弄清楚如何使用 Typelib 在 Euphoria DLL 之间传递 Unicode 字符串、bSTR。 到目前为止,我不明白的是如何创建并传回 BSTR 数组。
到目前为止我的代码(以及EuCOM本身和Win32lib的一部分的include
s):
global function REALARR()
sequence seq
atom psa
atom var
seq = { "cat","cow","wolverine" }
psa = create_safearray( seq, VT_BSTR )
make_variant( var, VT_ARRAY + VT_BSTR, psa )
return var
end function
typelib的一部分是:
[
helpstring("get an array of strings"),
entry("REALARR")
]
void __stdcall REALARR( [out,retval] VARIANT* res );
VB6中的测试代码是:
...
Dim v() as String
V = REALARR()
...
到目前为止我已经设法做到了get 是来自 DLL 的错误“0”。 有任何想法吗? 任何人?
So far I've figured out how to pass Unicode strings, bSTRs, to and from a Euphoria DLL using a Typelib. What I can't figure out, thus far, is how to create and pass back an array of BSTRs.
The code I have thus far (along with include
s for EuCOM itself and parts of Win32lib):
global function REALARR()
sequence seq
atom psa
atom var
seq = { "cat","cow","wolverine" }
psa = create_safearray( seq, VT_BSTR )
make_variant( var, VT_ARRAY + VT_BSTR, psa )
return var
end function
Part of the typelib is:
[
helpstring("get an array of strings"),
entry("REALARR")
]
void __stdcall REALARR( [out,retval] VARIANT* res );
And the test code, in VB6 is:
...
Dim v() as String
V = REALARR()
...
So far all I've managed to get is an error '0' from the DLL. Any ideas? Anyone?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该使用
create_safearray()
函数。 它记录在实用程序下(隐藏?)。 基本上,将 BSTR 指针放入一个序列中并将其传递给create_safearray()
:You should use the
create_safearray()
function. It's documented (hidden?) under Utilities. Basically, put your BSTR pointers into a sequence and pass it tocreate_safearray()
:我通过他们的
I've been in touch with the Euphoria people via their forum, and have gotten this far. The routine is failing on the the make_variant line. I haven't figured it out any further than that and neither have they.
好的,
var
尚未初始化。 这并不重要,因为例程仍然崩溃。 需要一个然而,在 make_variant 之前
Okay,
var
hasn't been initialised. Not that it matters as the routine still crashes. Nevertheless, one needs ajust before the make_variant