Solved

Rpc binding vector

Posted on 1998-03-31
3
315 Views
Last Modified: 2006-11-17
In microsoft rpc Rpc_Binding_vector  is a data structure, defined in header  rpcdce.h. It contains two elements, 1. count  showing number of binding handles in binding handle array 2. array of binding handles
In include file rpcdce.h the array size has been given as 1.
My doubt is it any way possible for a binding vector to have more than one binding handle ? if yes how?
0
Comment
Question by:sudhir033198
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
3 Comments
 
LVL 11

Accepted Solution

by:
alexo earned 20 total points
ID: 1257967
Of course it is!
Example comming...

0
 
LVL 11

Expert Comment

by:alexo
ID: 1257968
Let's take the following structure as an example:

    struct X
    {
        long count;
        int elements[1];
    };

The thing to remember is that the difference between "real macho" languages like C and wimpy Wirth languages is that in C it is legal, moral and accepted to lie to the compiler.
C allows accessing out-of-bounds array elements.  The following code is legal:

    struct X x;
    x.elements[0] = x.elements[42] = x.elements[-1000];

The compiler will happily generate code to access the n'th element, whatever n is.
So, the tricky part is allocating enough elements.  Static and automatic allocations will not work (obviously) but then, there's malloc().

Let's write a function that will return a pointer to a dynamically allocated structure with n elements (modulo typing errors):

    struct X * AllocateStruct(int n)
    {
        struct X *p = (struct X *) malloc(sizeof(long) + n * sizeof(int));
        p->count = n;
        return p;
    }

And use it thus:

    struct X *px;
    px = AllocateStruct(100);
    /* Do some stuff involving px */
    free(px);

OK?
0
 
LVL 11

Expert Comment

by:alexo
ID: 1257969
Hello???
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface I don't like visual development tools that are supposed to write a program for me. Even if it is Xcode and I can use Interface Builder. Yes, it is a perfect tool and has helped me a lot, mainly, in the beginning, when my programs were small…
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

695 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question