Closed NickNaso closed 7 years ago
Please see the issue https://github.com/NickNaso/ghostscript4js/issues/3 to avoid the compilation error.
#include <stdlib.h>
#include <stdio.h>
#include <ghostscript/gdevdsp.h>
#include <ghostscript/gserrors.h>
#include <ghostscript/iapi.h>
#include <ghostscript/ierrors.h>
int main () {
gsapi_revision_t r;
if (gsapi_revision(&r, sizeof(r)) == 0) {
printf("%s", r.product);
if (r.revision < 650)
printf("Need at least Ghostscript 6.50");
}
else {
printf("revision structure size is incorrect");
}
return 0;
}
#include <iostream>
#include <string>
#include <ghostscript/gdevdsp.h>
#include <ghostscript/gserrors.h>
#include <ghostscript/iapi.h>
#include <ghostscript/ierrors.h>
using namespace std;
int main () {
gsapi_revision_t r;
cout << sizeof(r);
int res = gsapi_revision(&r, sizeof(r));
cout << res;
cout << r.product;
return 0;
}
It will return an objet like this:
{
product: "-------",
copyright: "------",
revision: "------",
revisiondate: "------"
}
Method version implemented
Create the version method that have the responsability to check the actual version of ghostscript. It's important to be sure that the correct version of the ghostsctipt library is loaded.
Base the code as in the reference manual: