GSVersion (Structures)
Last changed: jmbpiano-216.21.193.15

.
Summary
This structure is filled in by the gsapi_revision function.

C# Definition:

[StructLayout(LayoutKind.Sequential)]
public struct GSVersion
{
    public IntPtr product;
    public IntPtr copyright;
    public int revision;
    public int revisionDate;
}

VB Definition:

<StructLayout(LayoutKind.Sequential)> _
Public Structure GSVersion
    Public product As IntPtr
    Public copyright As IntPtr
    Public revision As Integer
    Public revisionDate As Integer
End Structure

User-Defined Field Types:

None.

Notes:

When starting to work with the Ghostscript Interpreter API (gsapi.dll), it is helpful to start by getting the gsapi_revision function to work.

Here is a sample of how the GSVersion structure is filled in by the gsapi_revision function.

GPL Ghostscript

Copyright Some Company

815

20040922

Documentation

Tips & Tricks:

Originally this article showed the 'product' and 'copyright' fields as type 'string', but this causes a program crash when calling the gsapi_revision function (tested under VS2013 and 32-bit GPL Ghostscript v9.15).

Using IntPtr instead allows the struct to be passed correctly but requires a manual conversion. One way to accomplish this transparently is by making those two fields private and adding the following properties to the struct:

public String Product
{
    get { return Marshal.PtrToStringAnsi(product); }
    set { product = Marshal.StringToHGlobalAnsi(value); }
}

public String Copyright
{
    get { return Marshal.PtrToStringAnsi(copyright); }
    set { copyright = Marshal.StringToHGlobalAnsi(value); }
}