How to get return value from async from external function in PowerBuilder?

How to get return value from async from external function in PowerBuilder? I made a simple example in VB2013.NET 4.5 and compiled it as a DLL. And inside the DLL is such an asynchronous method:

test.dll

    public async Task<string> GetTestAsync()
    {
        Task<string> task = GetTest();

        string test = await task;

        return test;
    }

    public async Task<string> GetTest()
    {
        string test;
        test = "TEST";

        return test;
    }

and I called the DLL in PowerBuilder the following:

String test
test = String(myoleobject.GetPortsTestAsync())

if isnull(test) then
   messagebox('', 'null value')
end if

The result always returns a null value.

I tried this one too, but it still returns a null value.

    public Task<string> GetTestAsync()
    {
        return Task.Factory.StartNew(() =>
        {
            return "hello";
        });
    }
+4
source share
1 answer

, , , , - VB, PB , . , VB.

- PB, VB, . , - .

0

Source: https://habr.com/ru/post/1619603/


All Articles