tags:

views:

32

answers:

0

I am working on trying to pass data from one ANSI C program to another through RPC. The data that I need to send is currently being stored in a struct as an 'int **m' (a matrix). When I try to write out the IDL file and compile it with 'rpcgen -C -Sc myfile.x' using the following structure:

struct thread_data {
        int size;
        int start;
        int end;
        int *vector;
        int m[1000][1000];
};

I get the following error:

#include "myidl.h"
        int m[1000][1000]; 
^^^^^^^^^^^^^^^^^^^^   
myidl.x, line 11: expected ';'

If I try to make it a int ** (which is what I prefer) it says this:

#include "myidl.h"
        int **m; 
^^^^^^^^^^^^^^  
myidl.x, line 11: expected 'identifier'

I even tried it with the <> syntax as described on some sites:

#include "myidl.h"
        int m<1000><1000>; 
^^^^^^^^^^^^^^^^^^^^  
myidl.x, line 11: expected ';'

I have read several different web sites for IDL syntax and I just can't seem to figure out how to get what I want: passing matricies back and forth. Any help would be greatly appreciated.

EDIT With using the example below:

typedef struct {            
        int size;
        int start;
        int end;
        [size_is(size)] int *vector;
        [size_is(,size)] int **m;
} thread_data;

I get this error:

#include "myidl.h"
typedef struct {
^^^^^^^^^^^^^^^^
myidl.x, line 4: expected 'identifier'

Hans Passant is right, I tried that syntax from the sun site and it worked. It looks like they don't accept two dimensional arrays or pointers, so this is what i have, it compiled at least :p

typedef int VECTOR<>;

struct thread_data {
        int size;
        int start;
        int end;
        VECTOR v;
        VECTOR m<>;    
}; 

If anybody has a better suggestion for what I am trying to do (just pass matricies around) I am all ears :) Thank you Hans.