Hi itsme86. Could I get you to try running the following code, and let me know if it seg faults. If not, can you post your gcc version ("gcc -v").
[CODE]#include <stdio.h>
#include <stdlib.h>
...
Type: Posts; User: thealmightyone
Hi itsme86. Could I get you to try running the following code, and let me know if it seg faults. If not, can you post your gcc version ("gcc -v").
[CODE]#include <stdio.h>
#include <stdlib.h>
...
Well, the code I posted is a summary of what happens to variables related to the issue I had, thus I left out a LOT of code which I deemed to be unrelated.
Interestingly, when I compile the code...
Essence of the code regarding issue:
typedef struct BMS_Chkmem{
int elemsize;
} BMS_CHKMEM;
typedef struct BMS_Blkmem{
BMS_CHKMEM* chkmemhash[1013];
} BMS_BLKMEM;
Thanks for the explanations John, it all make sense now. Really appreciate it.
That fixed the compilation error.
If there aren't three declarations, but just one, then what does "(SCIP* scip, SCIP_READER* reader)" do, as it appears to contain two further variable...
I've vastly simplified the struct definitions to minimise the size of the code, but the meaning is the same. The query is with the definition of SCIP_Reader.
Once the macro define has been...
Gives me the same output as:
Are you referring to the use of -shared when compiling test.c, or when linking the objects? If test.c, then what would you suggest, as using that option is the...
I am trying to call one function in a .so which contains quite a lot of functions, but after having tried to get it working for days, am at a dead end. Using the nm command, the .so has a few...
Gotcha. Thanks all.
Very simple code, but I have no idea why it won't compile. Compiler 'expected expression before '{' token'.
#include <stdio.h>
int particles[3][6];
void new_particle(int);
int...
Yeah, I began coming to the realisation that what I wanted to isn't actually possible (I'm always looking for small and elegant solutions). Got it all working with some for loops now.
Well spotted. Not fixed the code, but 1 step there. Should be &normArray[0], and function should be defined to return float*. I still can't get it to compile though, am getting 'excess elements in...
Oh, you think calcNormals returns an array of size 9?
Arrays point[0], [1] and [2] are fed INTO calcNormal (called by normals[x]), which returns pointer to normArray (size 3), which normals[x] is...
That question confuses me, so will answer best I can. I am passing 3 arrays, of size 3, into calcNormal. calcNormal is recieving the arrays correctly, as it is correctly calculating values. I have...
It does have a second dimension. Point[0] is (0,0,0)
I have done some more playing around, and the problem is actually still here, and the problem is when transferring the contents of normArray to normals.
I had to make 'normals 2d', as if it is...
This is kinda embrassing.
Printed out first member of normals, and it's fine. The problem seems to be with the calcNormal function, as the values aren't quite correct. Somehow got it into my head...
The code does compile if I don't include the line in post #1 (which is not needed for program), but I'm pretty sure there's still a problem.
When array 'normals' tries to set itself to the values...
The arrays B and T are of the form:
T[8][3] = { {9.0, 4.6, -1.0}, etc}
B[8][3] = { {4.5, 1.0, -10.0}, etc}
If I decide to improve the code, I will localise stuff. For now, I just want to...
Post #3 answers your first question.
To answer your second question, I obviously can't use a local array, as the array would be lost when calcNormal ends. This is not the issue at all though.
Elysia, do you have any help for me?
normArrays is a global array, not local.
Probably worth clarifying that I don't want the contents of normals to point to normArray, but to be set to the values of normArray (set by the call to...
I do need to return a pointer/array of some sort, due to its actual implementation:
GLfloat normals[8][3] = {calcNormal(B[0], B[1], T[0]), calcNormal(B[1], B[2], T[1]),...}
I tried your...
I'm trying to write a function that takes as input 3 arrays, does some calculations, puts some values into a global array, then returns a pointer to that array.
function is:
GLfloat...
I have simply replaced the for with a while, but kept the '<=' as a personal preference. Code in first post updated.