On Aug 31, 2008, at 2:58 PM, Alan W. Irwin wrote:

On 2008-08-31 14:14-0700 Jerry wrote:

My posting of this problem at comp.lang.ada has produced some rather arcanediscussion.

There is one school of thought that says that my example, being all Ada, isdifferent than the real code (in PLplot) because plmap in my posted exampleis in Ada where in the real situation it is in C. The discussion revolvesaround how Ada handles calls to Ada subprograms while enforcing C callingconventions versus calls to C subprograms while enforcing C conventions.

So, I'm trying to modify the simple example so that plmap is written in C,more closely emulating the PLplot situation. Unfortunately, my C skills arevery poor and I can't get a simplified plmap to compile. My goal is to get itto compile then link to it from Ada.

Here is my feeble attempt at C:


<snip>

My C skills are not that great, but I think I can help you out.

In plplot.h you have to define the PLINT and PLFLT types. I did that by
inserting the lines

#include <stdint.h>
typedef double PLFLT;
typedef int32_t PLINT;

(That first #include #defines what int32_t means [a 32-bit integer
regardless of platform] for C99 compliant systems. If you don't have
stdint.h accessible on your system, then replace int32_t by int).

Then the command

gcc -c plmap.c

works for me. The -c option is required because you just want to compile that code and you do not want to link it to make a standalone executable out
of it.

Alan

Thanks, Alan.

Attached is a zip file that more closely emulates the PLPlot situation, with plmap written in C but with the callback, mapform19, written in Ada. Could a few of you test it to see if it runs or crashes on your machines? Either way, I'd like to report back to the geniuses at comp.lang.ada.

There's a little bash file included.

Jerry

Attachment: simple_test_case_with_c
Description: Binary data

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to