Search code examples
cshared-librariesvips

Where to invoke VIPS_INIT in a C shared library


I am working on a C shared library that would contain one function that receives a filename, and returns a pointer to the C-array representation of the image.

I read VIPS_INIT needs to be set in the beginning of the program, with argv[0] as its argument. However, since this is a shared library, I'm not sure where exactly do I need to place this.


Solution

  • libvips uses argv[0] to help discover message catalogues if its been relocated. If you don't need a relocatable package, you can just pass "" and it'll be fine.

    Other notes: be careful not to init from more than one thread at the same time, and make sure init finishes before you try any processing.