It works!! Thank you very much for your help! I haven't tried it on
Linux yet but I will tomorrow. I'm confident it will work there too as
all I have to do is change the dll references to the Linux binaries.
I did think of checking the return values. However, as I have never
used C or C++, I wasn't sure that it was going to help me since I'm
familiar with conventions regarding return values.
On a similar topic, as I am very unfamiliar with C and working with it
from C#, I see that images can be output to buffer but not sure if
there is a simple way I could get the image into a C# stream or byte
array (without saving then reopening the file) from the C interface?
Perhaps it is not possible without lots of code.
Thanks again!
Kyle
On Jun 1, 6:31 am, Mikhail Kvyatkovskiy
<
mkvyatkovs...@ggasoftware.com> wrote:
> Hello Kyle,
>
> We found what causes your problem. Options from indigo-renderer.dll are registered after the library is loaded. In you code indigo-renderer.dll is loaded when indigoRenderToFile() is called, but renderer options are used before it. That is why indigoSetOption() calls return -1 value instead of 1 is normal case. To fix this problem you need to call any function from IndigoRenderer before setting renderer options, like this:
>
> public static void StructureFromSMILES(string smiles)
> {
> int mol = indigoLoadMoleculeFromString(smiles);
> indigoLayout(mol);
>
> indigoRenderToFile(mol, "test.png"); // Load indigo-renderer.dll and register its options. Return -1
>
> indigoSetOption("render-output-format", "png"); // Option is set. Return 1 indigoSetOption("render-comment", "Caffeine"); // Option is set. Return 1 indigoSetOption("render-comment-position", "top"); // Option is set. Return 1 indigoSetOptionXY("render-image-size", 200, 250); // Option is set. Return 1 indigoRenderToFile(mol, "test.png"); // Draw correct picture. Return 1
>
> }
>
> It might be a good practice to check returned values of functions to find which of them works incorrectly.
>
> As for Indigo .NET universal package, I found that there are some problems in dll unloading which can produce segmentation fault on Linux, so it might be hard to use it now. We will try to fix them after Indigo 1.1 release. Anyway, your comments about experience of using this package on Mono are very appreciated.
>
> Best regards,
> Mikhail Kvyatkovskiy, GGA Software.
>
> On Jun 1, 2012, at 11:05 AM, Mikhail Kvyatkovskiy wrote:
>
> Hello Kyle,
>
> I had reproduced this problem. We will try to fix it.
>
> Also I made an experimental port of Indigo .NET API to Mono, it must be possible to use it on Linux and Mac OS X together with Windows. You can try to use it, but it have not been tested well yet, so it might contain some problems. Here is the link to package with universal versions of .NET libraries:
http://ggasoftware.com/accept?file=indigo-1.1-rc3%2Findigo-dotnet-1.1...