alangreer Posted March 25, 2013 Share Posted March 25, 2013 Apologies if this has already been asked but I could not find an answer. I need to compile C code on the power PMAC that makes use of the shared memory structures. I would be using various scripts and services on the power PMAC to automatically download code and compile it, and so I cannot use the Windows IDE. Whilst I can compile C code, and include RtGpShm.h without any problems the application fails to run with a segmentation fault. I am assuming I have not linked to the libraries I require, or I have not made the right calls in the first place. I imagine I could call something like volatile struct SHM *pshm; double pos = pshm->Motor[0].JogPos; So is there a basic guide I can follow to get a C program to compile on the Power PMAC that talks to the shared memory structures, and have I just messed up the code, should I set the LD_LIBRARY_PATH to point to libraries etc. Any help would be appreciated on this matter. Link to comment Share on other sites More sharing options...
shansen Posted March 25, 2013 Share Posted March 25, 2013 Alan: EDIT: I just realized that your program must be linked correctly, or you wouldn't be able to run the program at all, much less get a segfault. If you are still having trouble, check out this tutorial on GDB to help you debug the issue: http://beej.us/guide/bggdb/ I attached a sample makefile and a test program that might help. Just copy it to the Power PMAC (I like to use WinSCP for that purpose) and then run 'make'. After it compiles, run test.out to see P0 increment by 1.test program.zip 1 Link to comment Share on other sites More sharing options...
alangreer Posted March 26, 2013 Author Share Posted March 26, 2013 Thank you for your answer it is perfect, and your example is just what I was looking for. Thanks again! Link to comment Share on other sites More sharing options...
Recommended Posts