cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - If community subscription notifications are filling up your inbox you can set up a daily digest and get all your notifications in a single email. X

Why "Callback ProTkdllFunction" returns no output ProArgument to Web.Link caller

Kittychen
13-Aquamarine

Why "Callback ProTkdllFunction" returns no output ProArgument to Web.Link caller

1. I have a toolkit "Callback ProTkdllFunction" named io() as listed below.

2. Call io() from Web.Link OK but count of the output ProArguments from io() is always 0 while it should be 1.

3. Problem must be somewhere in the function io()  <-- I need help to find it.

The way to call io() from Web.Link :

sess.GetProToolkitDll("115937605053").ExecuteFunction("io",iArg) 

The result from io() is partially correct :
{
    "FunctionReturn": 32,  <--- echo the iArg.value.v.i correctly
    "OutputArguments": {}  
}
result.OutputArguments 
{
    "Count": 0  <==== should be 1, what's wrong in the function io()  ????
}

 

#define DllExport   __declspec( dllexport )

DllExport int io(ProArgument * inputs, ProArgument ** outputs){
    ProArgument  *args; 
    
    // compose the output ProArgument array , refer to protkdoc/api/provalue_h.html
    ProArrayAlloc(1,sizeof(ProArgument),1,(ProArray*) &args);
    ProValuedataStringSet( &(args[0].value), "hello world!");
    
    outputs = &args;  
    return inputs->value.v.i;  // echo the input ProArgument
}

 

 

ACCEPTED SOLUTION

Accepted Solutions
syalagudri
14-Alexandrite
(To:Kittychen)

You need to mention the output label and than set value. Using the same label you try to get the value in weblink.

 

Look at the following method.

void CreateOutputArgumentMessage(ProArgument** outputs, ProName label, char* message)

{

char trailline[PRO_COMMENT_SIZE];

ProError status;

ProComment returnMessage;

status = ProArrayAlloc(1, sizeof(ProArgument), 1, (ProArray*)outputs);

if (status == PRO_TK_NO_ERROR) {

ProWstringCopy(label, outputs[0]->label, PRO_VALUE_UNUSED);

outputs[0]->value.type = PRO_VALUE_TYPE_WSTRING;

ProStringToWstring(returnMessage, message);

ProValuedataWstringSet(&outputs[0]->value, returnMessage);

 

}

}

 

View solution in original post

3 REPLIES 3
syalagudri
14-Alexandrite
(To:Kittychen)

You need to mention the output label and than set value. Using the same label you try to get the value in weblink.

 

Look at the following method.

void CreateOutputArgumentMessage(ProArgument** outputs, ProName label, char* message)

{

char trailline[PRO_COMMENT_SIZE];

ProError status;

ProComment returnMessage;

status = ProArrayAlloc(1, sizeof(ProArgument), 1, (ProArray*)outputs);

if (status == PRO_TK_NO_ERROR) {

ProWstringCopy(label, outputs[0]->label, PRO_VALUE_UNUSED);

outputs[0]->value.type = PRO_VALUE_TYPE_WSTRING;

ProStringToWstring(returnMessage, message);

ProValuedataWstringSet(&outputs[0]->value, returnMessage);

 

}

}

 

Kittychen
13-Aquamarine
(To:syalagudri)

Thank you very much.
Perhaps the problem has another reason.
I tried to use the CreateOutputArgumentMessage() function to compose the output array but the result is still Count=0 as before.
This is the return object to Web.Link caller 
{
    "FunctionReturn": 888,
    "OutputArguments": {}
}
Look into the above OutputArguments:
{
    "Count": 0
}
void CreateOutputArgumentMessage(ProArgument** outputs, ProName label, char* message)
{
    char trailline[PRO_COMMENT_SIZE];
    ProError status;
    ProComment returnMessage;
    status = ProArrayAlloc(1, sizeof(ProArgument), 1, (ProArray*)outputs);
    if (status == PRO_TK_NO_ERROR) {
        ProWstringCopy(label, outputs[0]->label, PRO_VALUE_UNUSED);
        outputs[0]->value.type = PRO_VALUE_TYPE_WSTRING;
        ProStringToWstring(returnMessage, message);
        ProValuedataWstringSet(&outputs[0]->value, returnMessage);
    }
}

DllExport int io(ProArgument * inputs, ProArgument ** outputs){
    ProArgument  *args; // output array
    ProName       label = L"I am the label";
    char          message[] = "I am the message";

    CreateOutputArgumentMessage(&args, label, message);
    outputs = &args;  
    return inputs->value.v.i;  // echo the input ProArgument
}

Kittychen
13-Aquamarine
(To:syalagudri)

ProArray allocated in the ProTkdllFunction like this:

    status = ProArrayAlloc(1, sizeof(ProArgument), 1, (ProArray*)outputs);

How can the Web.Link caller do the ProArrayFree() and even ProArgumentProarrayFree() too?

Announcements


Top Tags