01-09-2005, 09:40 AM
A while ago, I asked Marzec how to implement temporary structs in FB. After some time he was able to point me to the right direction by advising me to make a dummy struct of the same name. After 2 days of reasearch and thinking about it on my own, I finally understand how GLUnurbs, GLUtesselators, and GLUquadrics structs are implemented. That is "hidden" from the user. Now I would like to clarify some things before starting the port.
Notice: All codes untestested!
In C/C++, you can do this:
Then hide the struct itself in a compiled program such as a LIB/OBJ.
Actual Struct code hidden:
After that, declare it like so in the header file:
Now this is fine and dandy in C/C++ as this is how coders hide implementation of code. I'm wondering if this could be done in FB.
As Marzec and I discussed this is supposed to work:
Since we only need a pointer:
One problem I see with is is the fact that in C/C++, you can just declare a structure and make a pointer to point to that struct but we have to declare a structure with a dummy member in FB.
Now what I'm really not sure is, since point3d is actually hidden from the user, and pointers in FB and C/C++ are identical (dword address?), would the above work around be valid?
In case you're all wondering, I'm porting the GLU header file and if I have time some other headers for SDL and GL but I only have till tonight to finish it or wait another week.
Thanks in advance!!!
Ps. v1c: Would it be possible for FB to have these funks?
1. LOWORD
2. HIWORD
I have just seen zydons windows example and he had to do an AND to extract what is required of Lparam/Wparam. having those funks would certainly make code more readable and understandable.
Notice: All codes untestested!
In C/C++, you can do this:
Code:
typedef struct point3d; //This is a valid declaration of a struct
Then hide the struct itself in a compiled program such as a LIB/OBJ.
Actual Struct code hidden:
Code:
typedef struct
{
float x;
float y;
float z;
}point3d;
After that, declare it like so in the header file:
Code:
void myfunk(point3d *blah) //pass byref as pointer to above struct
Now this is fine and dandy in C/C++ as this is how coders hide implementation of code. I'm wondering if this could be done in FB.
As Marzec and I discussed this is supposed to work:
Code:
type point3d
dummy as integer 'make a dummy struct
end type
Since we only need a pointer:
Code:
declare sub myfunk(byref blah as point3d)
One problem I see with is is the fact that in C/C++, you can just declare a structure and make a pointer to point to that struct but we have to declare a structure with a dummy member in FB.
Now what I'm really not sure is, since point3d is actually hidden from the user, and pointers in FB and C/C++ are identical (dword address?), would the above work around be valid?
In case you're all wondering, I'm porting the GLU header file and if I have time some other headers for SDL and GL but I only have till tonight to finish it or wait another week.
Thanks in advance!!!
Ps. v1c: Would it be possible for FB to have these funks?
1. LOWORD
2. HIWORD
I have just seen zydons windows example and he had to do an AND to extract what is required of Lparam/Wparam. having those funks would certainly make code more readable and understandable.