comp.lang.ada
 help / color / mirror / Atom feed
* ImageMagick libs and Ada
@ 2002-02-01 15:46 Zach Swanson
  2002-02-01 16:05 ` Jeffrey Creem
  2002-02-01 18:46 ` Stephen Leake
  0 siblings, 2 replies; 7+ messages in thread
From: Zach Swanson @ 2002-02-01 15:46 UTC (permalink / raw)


I'm hoping that perhaps someone here has tried to use the ImageMagick
graphics suite and sucessfully imported functions into Ada95.

Working on my senior year capstone project at USMA, my team is
developing a computer vision system and doing some parabolic mirror
image undistortion using ImageMagick-5.4.1 to access the
bitmaps/pixels. We are compiling the C code in Cygwin, and the Ada
code using GNAT under Windows 2000.

We have written our initial functions for this in ANSI C, the language
that ImageMagick is developed in. We would like to be able to import
these functions into Ada95, otherwise our only option is to compile
the C as an exectuble and use the GNAT "spawn" command to run the
binary as a seperate process. This is undesirable though since we
cannot pass/recieve paramaters this way.

Our import looks like this so far:
pragma import (C, undistort_func, "undistort_func");
pragma linker_options("img_manip.o");
pragma linker_options("img_functions.o");

With just this code the link would fail though because the ImageMagick
functions aren't included in the object code, so we also provided a
linker argument to the lib files provided by ImageMagick. This
argument was found using the Magick-Config file:
pragma linker_options("-L c:\cygwin\usr\local\lib\ -lmagick -ljpeg -lz
-lm -lpthread");

At this point all the lib files are found by the linker, but it
generates several hundred errors. The errors are generated inside the
source code of all the ImageMagick routines. The error message looks
like this:
"In function 'GetImageMagick' magick.c:178: undefined reference to
'__assert'
Other values that the linker is unable to reconcile are __impure_ptr
and __errno.

My faculty advisors suggested adding the linker argument -lc to
include the standard C library, but this didn't work either.

If anyone has successfully imported the ImageMagick library into
Ada95, or if you are familiar with the type of problem we're having,
help or suggestions would be much appreciated.
Thank you
Zach Swanson, United States Military Academy



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ImageMagick libs and Ada
  2002-02-01 15:46 ImageMagick libs and Ada Zach Swanson
@ 2002-02-01 16:05 ` Jeffrey Creem
  2002-02-02  5:06   ` Zach Swanson
  2002-02-01 18:46 ` Stephen Leake
  1 sibling, 1 reply; 7+ messages in thread
From: Jeffrey Creem @ 2002-02-01 16:05 UTC (permalink / raw)


Not sure but you may run into problems trying to mix cygwin and non-cygwin
programs when the cygwin stuff uses a non mingw environment.. I think
you end up needing two different C libraries if you mix and match cygwin and
non
cygwin code in the same executable.

It looks like people have compiled this for native win32 (v.s. cygwin's unix
compatibility mode).
ftp://ftp.yggdrasil.com/mirrors/site/ftp.simplesystems.org/pub/ImageMagick/b
inaries/

(Note since the above does not seem to include import libraries you may have
to either figure out how to rebuild from source this way yourself or perhaps
use
the included dlls along with tools like dll2def to build gcc style import
libraries.

In any case this does not seem too hard but of course this may not even
really be the
actual problem you are hitting. Let us know how it works out.



"Zach Swanson" <x24702@usma.edu> wrote in message
news:50c1a1b.0202010746.3ee4bd7a@posting.google.com...
> I'm hoping that perhaps someone here has tried to use the ImageMagick
> graphics suite and sucessfully imported functions into Ada95.
>
> Working on my senior year capstone project at USMA, my team is
> developing a computer vision system and doing some parabolic mirror
> image undistortion using ImageMagick-5.4.1 to access the
> bitmaps/pixels. We are compiling the C code in Cygwin, and the Ada
> code using GNAT under Windows 2000.
>
> We have written our initial functions for this in ANSI C, the language
> that ImageMagick is developed in. We would like to be able to import
> these functions into Ada95, otherwise our only option is to compile
> the C as an exectuble and use the GNAT "spawn" command to run the
> binary as a seperate process. This is undesirable though since we
> cannot pass/recieve paramaters this way.
>
> Our import looks like this so far:
> pragma import (C, undistort_func, "undistort_func");
> pragma linker_options("img_manip.o");
> pragma linker_options("img_functions.o");
>
> With just this code the link would fail though because the ImageMagick
> functions aren't included in the object code, so we also provided a
> linker argument to the lib files provided by ImageMagick. This
> argument was found using the Magick-Config file:
> pragma linker_options("-L c:\cygwin\usr\local\lib\ -lmagick -ljpeg -lz
> -lm -lpthread");
>
> At this point all the lib files are found by the linker, but it
> generates several hundred errors. The errors are generated inside the
> source code of all the ImageMagick routines. The error message looks
> like this:
> "In function 'GetImageMagick' magick.c:178: undefined reference to
> '__assert'
> Other values that the linker is unable to reconcile are __impure_ptr
> and __errno.
>
> My faculty advisors suggested adding the linker argument -lc to
> include the standard C library, but this didn't work either.
>
> If anyone has successfully imported the ImageMagick library into
> Ada95, or if you are familiar with the type of problem we're having,
> help or suggestions would be much appreciated.
> Thank you
> Zach Swanson, United States Military Academy





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ImageMagick libs and Ada
  2002-02-01 15:46 ImageMagick libs and Ada Zach Swanson
  2002-02-01 16:05 ` Jeffrey Creem
@ 2002-02-01 18:46 ` Stephen Leake
  2002-02-02  5:03   ` Zach Swanson
  1 sibling, 1 reply; 7+ messages in thread
From: Stephen Leake @ 2002-02-01 18:46 UTC (permalink / raw)


x24702@usma.edu (Zach Swanson) writes:

> I'm hoping that perhaps someone here has tried to use the ImageMagick
> graphics suite and sucessfully imported functions into Ada95.
> 
> Working on my senior year capstone project at USMA, my team is
> developing a computer vision system and doing some parabolic mirror
> image undistortion using ImageMagick-5.4.1 to access the
> bitmaps/pixels. We are compiling the C code in Cygwin, and the Ada
> code using GNAT under Windows 2000.

GNAT provides a fully functional C compiler; use that instead of
Cygwin. It will be far easier to sort out the object and library
dependencies. 

> "In function 'GetImageMagick' magick.c:178: undefined reference to
> '__assert'
> Other values that the linker is unable to reconcile are __impure_ptr
> and __errno.

Assert and errno are from the c library. __impure_ptr is from the
Cygwin emulation layer.

-- 
-- Stephe



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ImageMagick libs and Ada
  2002-02-01 18:46 ` Stephen Leake
@ 2002-02-02  5:03   ` Zach Swanson
  2002-02-02 12:52     ` Zach Swanson
  0 siblings, 1 reply; 7+ messages in thread
From: Zach Swanson @ 2002-02-02  5:03 UTC (permalink / raw)


Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov> wrote 

> GNAT provides a fully functional C compiler; use that instead of
> Cygwin. It will be far easier to sort out the object and library
> dependencies. 

The only reason that we're using cygwin at all is that the ImageMagick
environment uses some arcane config scripts that have to be called
under cygwin's gcc, the GNAT gcc is unable to resolve all the path
names and other references. We would love to be able to do the entire
thing without cygwin and just compile using GNAT, but in order to use
ImageMagick functions we're limited in that respect.

> > "In function 'GetImageMagick' magick.c:178: undefined reference to
> > '__assert'
> > Other values that the linker is unable to reconcile are __impure_ptr
> > and __errno.
> 
> Assert and errno are from the c library. __impure_ptr is from the
> Cygwin emulation layer.

Good to know where those are declared, thanks. Are there lib files
that I can link against in my Ada code so that the GNAT compiler can
resolve these issues? I've tried linking in libc but it didn't seem to
do anything to help.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ImageMagick libs and Ada
  2002-02-01 16:05 ` Jeffrey Creem
@ 2002-02-02  5:06   ` Zach Swanson
  2002-02-02 12:48     ` Jeffrey Creem
  0 siblings, 1 reply; 7+ messages in thread
From: Zach Swanson @ 2002-02-02  5:06 UTC (permalink / raw)


"Jeffrey Creem" <jeff@thecreems.com> wrote
> It looks like people have compiled this for native win32 (v.s. cygwin's unix
> compatibility mode).
> ftp://ftp.yggdrasil.com/mirrors/site/ftp.simplesystems.org/pub/ImageMagick/b
> inaries/
> 
> (Note since the above does not seem to include import libraries you may have
> to either figure out how to rebuild from source this way yourself or perhaps
> use
> the included dlls along with tools like dll2def to build gcc style import
> libraries.

Actually we tried to use the Win32 version of ImageMagick first, but
it turns out that you can't import the DLLs into Ada correctly (at
least not by following the instructions in the GNAT reference manual)
because the ImageMagick library did not include the necessary source
files to use the gnat tools that converts the dlls into usable libs.



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ImageMagick libs and Ada
  2002-02-02  5:06   ` Zach Swanson
@ 2002-02-02 12:48     ` Jeffrey Creem
  0 siblings, 0 replies; 7+ messages in thread
From: Jeffrey Creem @ 2002-02-02 12:48 UTC (permalink / raw)


I think you might be stuck then..I'd recommend writing on the cygwin
mailing list to see if there is a way to mix and match cygwin and mingw
programs
in the same image..This is essentially what you want to do and they would
know best
what can be done.

It may not be possible...Does it have to be ImageMagick? Perhaps you can
find some trial COM component that does what you want and gen a binding
to it with gnatcom....Or, can you run under Linux.
"Zach Swanson" <x24702@usma.edu> wrote in message
news:50c1a1b.0202012106.5ba7af2c@posting.google.com...
> "Jeffrey Creem" <jeff@thecreems.com> wrote
> > It looks like people have compiled this for native win32 (v.s. cygwin's
unix
> > compatibility mode).
> >
ftp://ftp.yggdrasil.com/mirrors/site/ftp.simplesystems.org/pub/ImageMagick/b
> > inaries/
> >
> > (Note since the above does not seem to include import libraries you may
have
> > to either figure out how to rebuild from source this way yourself or
perhaps
> > use
> > the included dlls along with tools like dll2def to build gcc style
import
> > libraries.
>
> Actually we tried to use the Win32 version of ImageMagick first, but
> it turns out that you can't import the DLLs into Ada correctly (at
> least not by following the instructions in the GNAT reference manual)
> because the ImageMagick library did not include the necessary source
> files to use the gnat tools that converts the dlls into usable libs.





^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: ImageMagick libs and Ada
  2002-02-02  5:03   ` Zach Swanson
@ 2002-02-02 12:52     ` Zach Swanson
  0 siblings, 0 replies; 7+ messages in thread
From: Zach Swanson @ 2002-02-02 12:52 UTC (permalink / raw)


> Assert and errno are from the c library. __impure_ptr is from the
> Cygwin emulation layer.

I went and searched through the cygwin libs and found libcygwin, so I
included that file in my linker options. Recompiled the Ada portion of
my code and most of the errors went away. Thanks a lot! Now it looks I
just need to resolve some issues with the jpeg libs, they're throwing
some _imp_jpeg_..... errors.
Thanks for the great tip about the location of those references, its
definitley getting me on the right track!



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2002-02-02 12:52 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-02-01 15:46 ImageMagick libs and Ada Zach Swanson
2002-02-01 16:05 ` Jeffrey Creem
2002-02-02  5:06   ` Zach Swanson
2002-02-02 12:48     ` Jeffrey Creem
2002-02-01 18:46 ` Stephen Leake
2002-02-02  5:03   ` Zach Swanson
2002-02-02 12:52     ` Zach Swanson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox