how to pass 4-6 values from dll to exe in 1 function?

1) how to pass 4-6 values from dll to exe in 1 function?

can i do that :

return (a,b,c,d,e);
Last edited on
You need to return structure or class.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
struct AStruct
{
    int a;
    int b;
    int c;
    int d;
    int e;
};

AStruct fun()
{
    AStruct result;
    ...
    return result;
}

thanks for denis

your code is in dll

then i am puzzle of how the code is in .exe

.exe
1
2
double a1 = happy (int a,int b,int c,int d,int e);


how to split them??

struct using:
1
2
3
4
5
AStruct structure;
structure.a = 1;
structure.b = 2;
structure.c = 3;
....



Do you know c++?
Last edited on
haha,
sorry, i learn pascal and some C ,duno C++

besides, i have thought out to use array to solve the problem

array SL [] [] to solve above

thanks anyway

btw, why there are structure data type occur??

don't array is enough??

what is the advantage of using structure data type??

to me , the structure of c++ program is confused, on the other hand, C is tidy and easy to understand ^^
Last edited on
You don't specify you task properly. You can use array if your data has equal types.
closed account (S6k9GNh0)
You don't have to pass with a struct...You can simply pass references or pointers and then assign the value the pointer is pointing to.

1
2
3
4
5
void myFunction(int &one, int *two)
{
   one = aValue; //The integer you passed as one is now changed to the value you want.
  *two = anotherValue; // The value the pointer was pointing to has changed..
}


I would think this is more valid than just creating an entire stucture for one function.
Last edited on
Topic archived. No new replies allowed.