Announcement

Collapse
No announcement yet.

C# and PB (part II)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • C# and PB (part II)

    Trying to interface my PowerBASIC GDImage.dll with C#

    I had the infamous "LoaderLock was detected" message from VS2005
    in order to get rid of it, and run the C# managed code, here is what to do:

    In VS2005 go to Debug/Exceptions.
    Open up the Managed Debugging Assistants node on the tree
    and scroll down till you find LoaderLock and uncheck it.

    This seems to get rid of the error most of the time...


    ------------------
    Patrice Terrier
    mailto[email protected][email protected]</A>
    www.zapsolution.com
    Addons: WinLIFT (Skin Engine), GDImage (Graphic control), Artwork (logo creation), GDI+ Helper (GDIPLUS)

    [This message has been edited by Patrice Terrier (edited September 15, 2006).]
    Patrice Terrier
    www.zapsolution.com
    www.objreader.com
    Addons: GDImage.DLL 32/64-bit (Graphic library), WinLIFT.DLL 32/64-bit (Skin Engine).

  • #2
    Not sure if it will help but I did manage to interface C# and
    Tsunami. in the following line, wrk is simply declared as STRING
    in the C# program.
    the tsu is the pointer-based structure that Tsunami uses to pass addresses &
    lengths back & forth. My program may not be pretty and may be
    the "wrong" way to do it but it does work. I got the idea ( and
    a lot of the code ) from the .Net interface.

    If it would help, I could email you the C# source. It's way too
    large to post here and I don't have any small samples.

    Code:
     wrk = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(tsu.dataPtr, tsu.dataLen);
    ------------------

    Comment


    • #3
      Paul

      Thank you for the kind offer.

      So far I think I have solved my problem (see below).
      Here is the C# syntax to declare a PB string function
      and a PB long function.
      - PB
      DECLARE FUNCTION RegisterGLImageClass LIB "GDIMAGE.DLL" ALIAS "RegisterGLImageClass" () AS LONG

      DECLARE FUNCTION ZI_Version LIB "GDIMAGE.DLL" ALIAS "ZI_Version" () AS STRING

      - C#
      [DllImport(@"c:\travail\gdimage\gdimage.dll")]
      public static extern int RegisterGDImageClass();

      [DllImport(@"c:\travail\gdimage\gdimage.dll")]
      public static extern string ZI_Version();

      ------------------
      Patrice Terrier
      mailto[email protected][email protected]</A>
      www.zapsolution.com
      Addons: WinLIFT (Skin Engine), GDImage (Graphic control), Artwork (logo creation), GDI+ Helper (GDIPLUS)

      [This message has been edited by Patrice Terrier (edited September 16, 2006).]
      Patrice Terrier
      www.zapsolution.com
      www.objreader.com
      Addons: GDImage.DLL 32/64-bit (Graphic library), WinLIFT.DLL 32/64-bit (Skin Engine).

      Comment


      • #4
        Thnaks for sharing both of you.

        ------------------
        Roy Cline

        [This message has been edited by Roy Cline (edited September 15, 2006).]
        Roy Cline

        Comment

        Working...
        X