- Aron Cox
- SnapDevelop
- Wednesday, 1 July 2020 10:07 AM UTC
So I have a C# dll I am already calling from PowerBuilder by compiling it as an Active/X control. Most calls return a class containing a number of variables and the PowerBuilder .Net Dll Importer can't handle these, ignoring them completely.
So this leads me to a couple of questions:
1. WIll the .Net Dll Importer ever handle these? If so, I will wait. I really like the idea of stepping into the C# code from PowerBuilder while debugging, hence the internest in SnapDevelop
2. If not, then I've heard I could wrap the calls in another dll. I have tested this and it works but it's not elegant. Is this the way to do it? Does anyone have a better way?
Here's how I have tested:
I take the call and change it to a void and instead of returning the result, store it in an instance variable. Then for each type in the returned class I create a method to return the value, so I end up with something like
private MyResultClass _result
public void MyMethod(string arg1, string arg2)
{
. ..do some stuff
_result = result;
}
public Boolean ResultSuccess()
{
return _result.Success;
}
public String ResultMsg()
{
return _result.Msg;
}
Then in the PowerBuilder code I have to call MyMethod, then call each of ResultSuccess and ResultMsg and put them into a PowerBuilder structure. I could probably write a generator to do all of this but it seems a bit inelegant.
The only other way I can think of is to serialise the result to XML, return it as a string and then extract it from the XML somehow. As far as I know there isn't an XML to Structure import in PowerBuilder. I can import to a datastore but I'm not sure that really helps all that much.
Any ideas are welcome.
Thanks!
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.