DLL Parameters: passing by reference

Eric J.
APPLETON, WI

Jul 14, 2025
5 Posts

0  |  0  

Re: DLL Parameters: passing by reference

Does anyone have an example that demonstrates a call to a dll with function of this type where ATEasy needs to provide a pointer to wchar_t?

dll header:

typedef wchar_t WideChar;
extern "C" {
   Word __cdecl getResponse( WideChar * cpResponse)
};

This is to the Cirris Tester Access (CTA) dll.  I can't seem to get an ATEasy variable type to satisfy what Cirris is looking for to return data from various dll calls.  I've attached the CTA manual, and will follow up with a header.

I have an open incident, but we're not quite there yet.  Any help is appreciated.

Eric


File Attachment:
CTA User Manual 2024.4.2.pdf

DrATEasy (Ron Y.)
Mission Viejo, CA

Jul 14, 2025
381 Posts

0  |  0  

Re: DLL Parameters: passing by reference

Hi,

First determine what DLL you are using (ATEasy DLL properties) there are 2 versions 32 or 64 -  use the matching ATEasy 32 or 64-bit IDE.

I could not find documentation in the manual for that function getResponse ??

In C wchar_t * in C is ambiguous, it is a pointer to 2 byte character but could also be pointer to array of 2 bytes used mostly for multi byte encoding of text. Since there is not documentation, I would probably allocate an array of Word and pass it to this function and try it:


aw: Word [10000] ! hopefully that enough


define the function in ATEasy as

getresponse(awResponse : Var Word[]) : CDecl Word


call the function:

print getRespomse(aw)


and see what is returned and printed.


Ronnie

Eli G.
Appleton, WI

Jul 14, 2025
3 Posts

0  |  0  

Re: DLL Parameters: passing by reference

Hello,

I tried doing this...

Temp="MyCaption"
bsMyCaption=Temp
Temp="MyMesssage"
bsMyMesssage=Temp
iTimeoutInMilliseconds=0
aw: Word[10000]

wStatus=CTA.CirrisTesterAccess.ctaDisplayMessage(wConnectionID, bsMyCaption, bsMyMesssage, False, iTimeoutInMilliseconds, iResponseLength, aw)

print wStatus; " = CTA.CirrisTesterAccess.ctaDisplayMessage(wConnectionID, bsMyCaption, bsMyMesssage, False, iTimeoutInMilliseconds, iResponseLength, bsResponse)"


...but it was telling me undefined symbol 'Word' so I defined Response as a "Word" within the "Variables" section of the program and tried this...

wStatus=CTA.CirrisTesterAccess.ctaDisplayMessage(wConnectionID, bsMyCaption, bsMyMesssage, False, iTimeoutInMilliseconds, iResponseLength, Response)

...which compiles and runs, but the function throws error code 1: buffer size too small. The passed message was "hello"


File Attachment:
ateasy.png

DrATEasy (Ron Y.)
Mission Viejo, CA

Jul 14, 2025
381 Posts

0  |  0  

Re: DLL Parameters: passing by reference

Can't tell from the information you provided. How did you define Response? iResponseLength probably need to be initialized with the size of the Response buffer before calling the function.

Ronnie

Eli G.
Appleton, WI

Jul 14, 2025
3 Posts

0  |  0  

Re: DLL Parameters: passing by reference

Hello,

I tried doing this...

Temp="MyCaption"
bsMyCaption=Temp
Temp="MyMesssage"
bsMyMesssage=Temp
iTimeoutInMilliseconds=0
aw: Word[10000]

wStatus=CTA.CirrisTesterAccess.ctaDisplayMessage(wConnectionID, bsMyCaption, bsMyMesssage, False, iTimeoutInMilliseconds, iResponseLength, aw)

print wStatus; " = CTA.CirrisTesterAccess.ctaDisplayMessage(wConnectionID, bsMyCaption, bsMyMesssage, False, iTimeoutInMilliseconds, iResponseLength, bsResponse)"


...but it was telling me undefined symbol 'Word' so I defined Response as a "Word" within the "Variables" section of the program and tried this...

wStatus=CTA.CirrisTesterAccess.ctaDisplayMessage(wConnectionID, bsMyCaption, bsMyMesssage, False, iTimeoutInMilliseconds, iResponseLength, Response)

...which compiles and runs, but the function throws error code 1: buffer size too small. The passed message was "hello"


File Attachment:
ateasy.png

Solution Available
Eli G.
Appleton, WI

Jul 14, 2025
3 Posts

1  |  0  

Re: DLL Parameters: passing by reference

Hi, got things working. I had to define cpResponse as Var Wchar[] and Response as WChar[1024]. Below is working code. Temp is BString.

Temp="MyCaption"
bsMyCaption=Temp
Temp="MyMesssage"
bsMyMesssage=Temp
iTimeoutInMilliseconds=0
Response=Spaces(1024)

wStatus=CTA.CirrisTesterAccess.ctaDisplayMessage(wConnectionID, bsMyCaption, bsMyMesssage, False, iTimeoutInMilliseconds, iResponseLength, Response)

print wStatus; " = CTA.CirrisTesterAccess.ctaDisplayMessage(wConnectionID, bsMyCaption, bsMyMesssage, False, iTimeoutInMilliseconds, iResponseLength, bsResponse)"
print "iResponseLength = "; iResponseLength
Temp = Response
print Temp

DrATEasy (Ron Y.)
Mission Viejo, CA

Jul 14, 2025
381 Posts

0  |  0  

Re: DLL Parameters: passing by reference

Great!



Please Note
You need to have a M@GIC account to participate in the Forums.
Not yet registered on our website? Click here to register today!

All content, information and opinions presented on the Marvin Test Solutions User Forums are those of the authors of the posts and messages and not Marvin Test Solutions'. All attachments and files are downloaded at your own risk. [Read More]