[foxboro] OM programming question

On Fri, 24 Sep 2004 11:18:03 -0400, Mark Dumond <mdumond@xxxxxxxxxxxxxx> wrote:
> This may open up a can of worms, but I am beginning to believe 
> that using FoxAPI isn't the best method for implementing programs 
> that need to read  and write Foxboro data via C calls.
> I have gone back to using the old core Object Manager calls 
> (which are well documented in the "Programming" section of docs), 

I have written a small C program to close an OM list when given the list
number.  I get a segmentation fault about 50% of the time when using this.
Does anyone see an obvious problem:

--------------------------------------------------------------------------------------------
#include <stdlib.h>
#include <stdio.h>
#include <fox/om_user.h>
#include <fox/om_ecode.h>

void errorCheck(int);

int main(int argc, char *argv[])
{
        struct header_node om_list_hdr;
        struct open_var vars[1];
        int ret, list;

        if(argc != 2)
        {
                printf("\nUsage: %s list_number\n\n", argv[0]);
                exit(1);
        }

        list = atoi(argv[1]);

        om_list_hdr.task_status = OM_RW_ACCESS;
        om_list_hdr.net_adr_tbl_ptr = NULL;
        om_list_hdr.open_list_ptr = vars;

        ret = omclose(list, &om_list_hdr, vars, NULL);
        errorCheck(ret);

        return(0);
}

void errorCheck(int returnValue)
{
        if(returnValue != OM_SUCCESS)
        {
                printf("error: %d\n", returnValue);
        }
}
 
 
_______________________________________________________________________
This mailing list is neither sponsored nor endorsed by Invensys Process
Systems (formerly The Foxboro Company). Use the info you obtain here at
your own risks. Read http://www.thecassandraproject.org/disclaimer.html
 
foxboro mailing list:             http://www.freelists.org/list/foxboro
to subscribe:         mailto:foxboro-request@xxxxxxxxxxxxx?subject=join
to unsubscribe:      mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave
 

Other related posts: