Jump to content


  • Content Count

  • Joined

  • Last visited


Community Reputation


About blueshrimp

  • Rank
    I've come back for more.
  1. QUOTE(Neville D @ Aug 21 2007, 05:04 PM) Because I am writing code for an embedded system (you need to tailor-write most embedded systems code so that it uses resouces most efficiently, as embedded systems are typically quite resource-constrained). For historical (and not very good) reasons, my company used LabView to prototype their algorithms. This makes them run very slow on a PC. Now we need to port to an embedded system. Ergo: need to write functions from scratch in C. The current C dll is used to validate our algorithm porting. It runs on a PC in parallel to the labview so that we can confirm that our C code does exactly what the labview does. Once we finish with the validation, we will get rid of the labview and run C native all the time. Labview is nice for controlling motors and suchlike in the lab or university, but is not what you want to be running in a complex embedded system that ships out to customers. Too big and slow. Anyway, thanks for your replies guys. Looks like I have to "flatten" the array or do lots of formatting tricks and deal with LV handles since C is tricky with matrix handling. Too bad, I was hoping there was a simpler way, oh well.
  2. Hi there, newbie here. I did a search but could not find good answer to my question. I have a simple LabView vi that takes in a 2D Array (user defines it, it is a "control" input) called A, an array b, and an initialized (all zeros) array x that is the same size as b. Then I am trying to pass this to a C function in a library I'm writing, which will solve Ax=b. I do not know in advance the size of the matrix A, but it is assumed to be square (therefore it is the same size as arrays b and x). My problem is passing this matrix A into my function. I can pass b and x successfully, but my execution chokes up on A. Here's my C function prototype: _declspec(dllexport) unsigned char GaussJordan(double **A, double b[], double x[], unsigned long dim); However, when I do to "configure" in the dll vi, it keeps generating the prototype: unsigned char GaussJordan(double *A, double *b, double *x, unsigned long dim); even when I tell it that A should be a 2D array. When I stop my debugger right inside my C function call, I see that A[0] is 0, and then A[0][0] "cannot be evaluated". When I change my function prototype to: _declspec(dllexport) unsigned char GaussJordan(double A[3][3], double b[], double x[], unsigned long dim); for instance, then with my debugger I can see inside my GaussJordan an A matrix that makes sense (i.e. is exactly what I passed in). However, this is then a problem because inside GaussJordan I have a function call to: solveeqn(double **A, double b[], double[x], unsigned long size) Which dies because A[3][3] is not of type double *[3]. Since I am using solveeqn on matrices of variable size elsewhere on the code, I cannot lock it to the size that labview desires. Not to mention that having to write a different vi to C interface on the day I decide to solve 4x4 matrices instead of 3x3 matrices is too much work. So, the question is: how do I pass a variable-sized (assumed square) 2D array from LabView into a C function, if the size of this array is unknown in advance/unknown at compile time?? Any help will be greatly appreciated! Thanks, -Elisa.
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.