summaryrefslogtreecommitdiff
path: root/vibrant/shim3d.c
diff options
context:
space:
mode:
Diffstat (limited to 'vibrant/shim3d.c')
-rw-r--r--vibrant/shim3d.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/vibrant/shim3d.c b/vibrant/shim3d.c
index 8a5abe72..5a291297 100644
--- a/vibrant/shim3d.c
+++ b/vibrant/shim3d.c
@@ -321,6 +321,7 @@
#ifdef _PNG
#include <png.h> /* must go berore ncbi headers */
+#include <zlib.h>
#ifndef png_jmpbuf
#define png_jmpbuf(x) ((x)->jmpbuf)
#endif
@@ -339,7 +340,8 @@ NLM_EXTERN void LIBCALL Nlm_HeapSort PROTO((VoidPtr base, size_t nel, size_t wid
#include <ddvcolor.h>
#if defined(_OPENGL) && defined(_PNG)
-TOGL_Data *Cn3D_GetCurrentOGLData(void); /* in cn3dxprt.c */
+/* In cn3dxprt.c; declared weak here to avoid dependency loops. */
+extern TOGL_Data *Cn3D_GetCurrentOGLData(void) __attribute__((weak));
#endif
@@ -2939,7 +2941,15 @@ void Nlm_SaveImagePNG(Nlm_Char *fname)
png_structp png_ptr = NULL;
png_infop info_ptr = NULL;
Nlm_Boolean doInterlacing = TRUE;
- TOGL_Data *OGL_Data = (TOGL_Data *)(Cn3D_GetCurrentOGLData());
+ TOGL_Data *OGL_Data;
+
+ if (!Cn3D_GetCurrentOGLData) {
+ Message(MSG_ERROR, "PNG output unavailable; "
+ "please relink application with -lncbicn3d.");
+ return;
+ }
+
+ OGL_Data = (TOGL_Data *)(Cn3D_GetCurrentOGLData());
#if defined(WIN_MOTIF)
GLint glSize;
@@ -3720,4 +3730,3 @@ void Nlm_AddHalfWorm3D(Nlm_Picture3D pic,
if (fblock)
MemFree(fblock);
}
-