comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » problem with call_external
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
problem with call_external [message #2783] Fri, 16 September 1994 12:04 Go to previous message
knight is currently offline  knight
Messages: 37
Registered: January 1992
Member
I am trying to call a c function from IDL, and it works *ONCE.* On the second
call, I get the following:

IDL> a=get_sdv_frame()
% Unable to free memory: from array descriptor.
Invalid argument
% Execution halted at GET_SDV_FRAME </users/nuc/idl/pro/get_sdv_frame.pro(
46)> .
% Called from $MAIN$ .
IDL>

Is this a symptom you can tie to a specific cause? In this case, I am
transferring data from a digital frame grabber to the location of an IDL array.

I attach the particulars below.

Thanks, Fred


-------------------------------IDL site -------------------------------

IDL. Version 3.6 (sunos sparc).
Copyright 1989-1994, Research Systems, Inc.
All rights reserved. Unauthorized reproduction prohibited.
Installation number: 2016-1.
Licensed for use by: Groups 101 and 105


-------------------------------IDL function to call_external ---------------
;+
; NAME:
; get_sdv_frame
; PURPOSE:
; This function returns a frame of data read from the SDV digital frame
; grabber.
; EXAMPLE:
; a = get_sdv_frame(sdvunit)
; CALLING SEQUENCE:
; a = get_sdv(sdvunit[,options])
; INPUTS:
; sdvunit = 0 or 1, depending on which SDV card is being accessed
; OPTIONAL INPUTS:
;
; KEYWORD PARAMETERS:
; help = flag to print this header
; OUTPUTS:
; a = frame of data, usually shorts, with dimensions selected via last
; execution of the program script sdvload
; OPTIONAL OUTPUTS:
;
; COMMON BLOCKS:
;
; SIDE EFFECTS:
;
; RESTRICTIONS:
;
; PROCEDURE:
;
; MODIFICATION HISTORY:
; write, 15 Sep 94, FKK (knight@ll.mit.edu)
;-
FUNCTION get_sdv_frame,sdvunit,help=help
;
; =====>> HELP
;
IF keyword_set(help) THEN BEGIN
doc_library,'get_sdv_frame'
return,0
ENDIF
;
; =====>> Use call external
;
IF n_elements(sdvunit) EQ 0 THEN sdvunit = 0
frame = intarr(255,256) ; frame buffer
result = call_external( $
'/export/home/telluride/sdv/new/get_sdv_frame.so' $ ; .so location
,'get_sdv_frame' $ ; symbol
,long(sdvunit) $ ; 1st param
,frame) ; 2nd param
return,frame
END

---------------------------- c code in .so file ---------------------

/*
* Function to grab one frame from the sdv card.
* Start with $SDV/new/sdvread.c.
* Modify for use with IDL via call_external.
* knight@ll.mit.edu, 15 Sep 94
*/

#include <stdio.h>
#include <sys/types.h>
#include "camera.h"
#include "sdvlib.h"

int get_sdv_frame(argc,argv)
int argc ;
void *argv[] ;
{
char devname[20];
SdvDev *sd;

sprintf(devname,"/dev/sdv%d",*(int *) argv[0]) ;
if ((sd = sdv_open(devname, SDV_NOLOCKDEV)) == NULL)
{
printf("couldn't open %s\n",devname);
exit(1);
}
sd->image = (caddr_t)argv[1];
if (sdv_grab(sd) < 0)
printf("couldn't get frame from %s\n",devname);
sdv_close(sd) ;
free(argv[1]);
printf("done\n") ;
}


--------------------------- makefile -------------------------

get_sdv_frame: get_sdv_frame.c sdvlibso.c
cc -pic -fsingle -c get_sdv_frame.c
cc -pic -fsingle -c sdvlibso.c
ld -o get_sdv_frame.so -assert pure-text get_sdv_frame.o sdvlibso.o
--
=Fred Knight (knight@ll.mit.edu) (617) 981-2027
C-483\\MIT Lincoln Laboratory\\244 Wood Street\\Lexington, MA 02173
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Problem with call_external
Next Topic: IDL for linux on Macintosh ppc

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Fri Oct 17 09:54:56 PDT 2025

Total time taken to generate the page: 0.71994 seconds