?
Solved

Rpc binding vector

Posted on 1998-03-31
3
Medium Priority
?
318 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 40 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
The goal of this video is to provide viewers with basic examples to understand and use pointers in the C programming language.
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
Suggested Courses

752 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