Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

GSVersion (Structures)
 
.
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); }
}

Please edit this page!

Do you have...

  • helpful tips?
  • corrections to the existing content?
  • alternate definitions?
  • additional languages you want to include?

Select "Edit This Page" on the right hand toolbar and edit it! Or add new pages containing any supporting types needed.

 
Access PInvoke.net directly from VS:
Terms of Use
Edit This Page
Find References
Show Printable Version
Revisions