Phreak87 / LeptonicaSharp

Full featured wrapper for leptonica 1.77.0
Other
8 stars 5 forks source link

Out Parameters #23

Closed fdncred closed 5 years ago

fdncred commented 5 years ago

While trying to use your library for a CSharp app, I notice that I need out parameters instead of just refs. Can you add the out attribute to all out parameters? Before:

    Public Shared Function pixGetRegionsBinary(
                ByVal pixs As Pix,
                ByRef ppixhm As Pix,
                ByRef ppixtm As Pix,
                ByRef ppixtb As Pix,
                ByVal pixadb As Pixa) As Integer

After

    Public Shared Function pixGetRegionsBinary(
                ByVal pixs As Pix,
                <Out()> ByRef ppixhm As Pix,
                <Out()> ByRef ppixtm As Pix,
                <Out()> ByRef ppixtb As Pix,
                ByVal pixadb As Pixa) As Integer

This enables a CSharp user to do that following:

static void Main(string[] args)
{
    Natives.Initialize();
    _AllFunctions.setLeptDebugOK(1);
    var pix = new Pix(file6);
    var pixa = _AllFunctions.pixaCreate(0);
    _AllFunctions.pixGetRegionsBinary(pix, out Pix ppixhm, out Pix ppixtm, out Pix ppixtb, pixa);
}
Phreak87 commented 5 years ago

That's new to me. Give it a try!

fdncred commented 5 years ago

I tried it and it works.

Phreak87 commented 5 years ago

Implemented in the next release

Phreak87 commented 5 years ago

Please check if it works in your environment

fdncred commented 5 years ago

The one function that I tested with, posted in this thread above, does not have Out variables. I only see three functions that have out variables. So, I wouldn't say it's implemented. Reopening.

Phreak87 commented 5 years ago

oh crap!

now its on your function too 👍 But still Not usable in My Dev. Environment. 😐

fdncred commented 5 years ago

Why are you closing this issue if the problem isn't fixed?

Phreak87 commented 5 years ago

It's fixed but not public. You have to wait For the new version

fdncred commented 5 years ago

<Out()> and <para/> seem to be working.