1. Rick Domogalik
  2. PowerBuilder
  3. Monday, 10 August 2020 13:13 PM UTC

I am using the .NET DLL Importer to bring a vendor's DLL into my PowerBuilder app.  Below are a couple of screen shots.  Not sure what is going on, but basically seeing two issues.

1. Several functions appear in the failed items list. Any insight how to handle failed imports?

2. Several functions do not import at all.  They are not in the failed items.  They just aren't there.  The third pic is a list of all the functions that should be coming over during the import.

SearchJob is the only class I need from the DLL.  At the very bottom I have a clip of c# code provided by the vendor.  From what I can tell, the functions that are not showing up might be using some dot notation for example

sj.indexesToSearch.Add(indexpath);    and

results.currentitem.filename;

The items that do not use dot notation at all, seem to be the functions that imported correctly.

string indexPath = @"C:\indexes\myindex";  // your path

SearchJob sj = new SearchJob();

sj.IndexesToSearch.Add(indexPath);

sj.Request = "apple";

sj.Execute();

 

SearchResults results = sj.Results;

for (int i = 0; i < results.Count; i++)

{

    results.GetNthDoc(i);

    var filename = results.CurrentItem.Filename;   // and otherwise interact with results.CurrentItem

}

 

 

 

Rick Domogalik Accepted Answer Pending Moderation
  1. Tuesday, 11 August 2020 14:47 PM UTC
  2. PowerBuilder
  3. # 1

I haven't received any responses for my importer question.  So I went on to try to create a "wrapper" to see if that would get me going.

I created the code below in snapdevelop and built with no issues.  When I try to import that DLL into PowerBuilder, I still get a failed item on the method because of the return value.  With the hint at the top saying to create a wrapper to correct.  So, guessing I did not create my wrapper correctly.  I am trying to return an string array.  Is this just not possible with the DLL Importer and PowerBuilder?

 

Any help would be greatly appreciated.

 

Rick

 

 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using dtSearch.Engine;

namespace Searchtest 
{

    public class Test
    {
        public List<string> RunSearchAndGetMatchingFilenames(string indexPath, string request)
        {
            List<string> allResults = new List<string>();

            SearchJob sj = new SearchJob();
            sj.IndexesToSearch.Add(indexPath);
            sj.Request = request;
            sj.Execute();

            SearchResults sr = sj.Results;
            for (int i = 0; i < sr.Count; i++)
            {
                sr.GetNthDoc(i);
                allResults.Add(sr.CurrentItem.Filename);
            }

            return allResults;
        }


    }

}

Comment
  1. Mark Lee @Appeon
  2. Friday, 14 August 2020 09:31 AM UTC
Hi Rick,



1. Currently, the List<string> param is not supported. Please refer to the following link for supported data types.

https://docs.appeon.com/pb2019r2/application_techniques/ch20s01.html



2. You can work around the issue with the code example below.

public string[] RunSearchAndGetMatchingFilenames(string indexPath, string request)



3. For the nested class issue, you can refer to the following link:

https://docs.appeon.com/pb2019r2/application_techniques/ch20s01.html#d0e14866

Nested class is supported, except that using the plus sign (“+”) instead of the dot (“.”) to access the nested class: [namespace].[class]+[nested-class].



Regards,
  1. Helpful
There are no comments made yet.
Armeen Mazda @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 11 August 2020 15:12 PM UTC
  2. PowerBuilder
  3. # 2

Please carefully read the documentation about what is supported:  https://docs.appeon.com/pb2019r2/application_techniques/ch20s01.html

String data type and array are supported, bit it cannot be Generic Nullable<T>.

 

 

Comment
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.