473,395 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

dot.net com class function

gs
what is the proper interop description for result of string array for an
function that is to be called through com interface by legacy application?

I tried
Public Function etstor0(<Out()> ByRef iCnt As Integer, _
<Out()> <MarshalAs(UnmanagedType.LPArray,
ArraySubType:=UnmanagedType.LPStr, SizeParamIndex:=0)> ByRef
strMatchReslts() As String _
) As Integer

----
end Function

I was calling something like this from a legacy application

// establish, initialize the com class object: myComclass
string sresult[]
long ll_cnt, ll_rc

ll_rc = myComclass.estor(Ref ll_cnt, Ref sresult)
but I got a message saying
Error calling external object function etstor0
I have established that in this legacy application, long is the vb integer,
and plan old string without array is ok with calling this .net com class
function that do not involve arrays.
May 11 '06 #1
2 1233
Does your function change the array as a whole (I mean, something like
strMatchResults = New String(){...})? If it doesn't, then you maybe have
to declare strMatchResults ByVal, not ByRef.

Roman

"gs" <gs@nomail.nil> сообщил/сообщила в новостях следующее:
news:#b**************@TK2MSFTNGP04.phx.gbl...
what is the proper interop description for result of string array for an function that is to be called through com interface by legacy application?
I tried
Public Function etstor0(<Out()> ByRef iCnt As Integer, _
<Out()> <MarshalAs(UnmanagedType.LPArray,
ArraySubType:=UnmanagedType.LPStr, SizeParamIndex:=0)> ByRef
strMatchReslts() As String _
) As Integer

----
end Function

I was calling something like this from a legacy application

// establish, initialize the com class object: myComclass
string sresult[]
long ll_cnt, ll_rc

ll_rc = myComclass.estor(Ref ll_cnt, Ref sresult)
but I got a message saying
Error calling external object function etstor0
I have established that in this legacy application, long is the vb integer, and plan old string without array is ok with calling this .net com class function that do not involve arrays.

May 12 '06 #2
gs
the function does change the array with match results from regex operations
"Dragon" <no@spam.please> wrote in message
news:%2****************@TK2MSFTNGP02.phx.gbl...
Does your function change the array as a whole (I mean, something like
strMatchResults = New String(){...})? If it doesn't, then you maybe have
to declare strMatchResults ByVal, not ByRef.

Roman

"gs" <gs@nomail.nil> сообщил/сообщила в новостях следующее:
news:#b**************@TK2MSFTNGP04.phx.gbl...
what is the proper interop description for result of string array for

an
function that is to be called through com interface by legacy

application?

I tried
Public Function etstor0(<Out()> ByRef iCnt As Integer, _
<Out()> <MarshalAs(UnmanagedType.LPArray,
ArraySubType:=UnmanagedType.LPStr, SizeParamIndex:=0)> ByRef
strMatchReslts() As String _
) As Integer

----
end Function

I was calling something like this from a legacy application

// establish, initialize the com class object: myComclass
string sresult[]
long ll_cnt, ll_rc

ll_rc = myComclass.estor(Ref ll_cnt, Ref sresult)
but I got a message saying
Error calling external object function etstor0
I have established that in this legacy application, long is the vb

integer,
and plan old string without array is ok with calling this .net com

class
function that do not involve arrays.


May 13 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Fernando Rodriguez | last post by:
Hi, I need to traverse the methods defined in a class and its superclasses. This is the code I'm using: # An instance of class B should be able to check all the methods defined in B #and A,...
12
by: Gaurav Veda | last post by:
Hi ! I am a poor mortal who has become terrified of Python. It seems to have thrown all the OO concepts out of the window. Penniless, I ask a basic question : What is the difference between a...
3
by: Robert | last post by:
Python doesn't know the class of a method when container not direct class attribute: >>> class X: .... def f():pass .... g=f .... l= .... >>> X.g <unbound method X.f>
8
by: Nick | last post by:
I have the following code: var obj = {a:0, b:1, ...} function f() {...} obj.f = f // This will make a instance method? How to make a Class method for the class of obj? Or what's the...
9
by: mead | last post by:
What kind of classes is qualified as "concrete classes"? When should a member function in a class defined as "pure virtual" and when as "virtual"? Thanks!
2
by: dinks | last post by:
Hi, I'm new to C++ and have been assigned a task which i dont completely understand. Any help would be greately appreciated. Here is the problem: The class "linkedListType" use the "assert"...
9
by: baumann | last post by:
hi all, to implement a singleton class, one has define a static function in the singleton class, class A{ public: static A* getInstance() { static A a; return &a;
6
by: Ken Foster | last post by:
Is it possible to return a class (not an instance of a class) from a function? For example (actually tried this code, it didn't work, but it's what I want sort of): Class EventMessage Public...
4
by: zfareed | last post by:
#include <iostream> #include <fstream> using namespace std; template<class ItemType> class SortedList { private:
5
by: Ben | last post by:
Hi, i defined a function in the base class 'ford' and the same function (with different output) in subclass "peugeot". I first put 'Overridable function' in the base class and 'Overrides...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.