LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware > Linux - Embedded & Single-board computer
User Name
Password
Linux - Embedded & Single-board computer This forum is for the discussion of Linux on both embedded devices and single-board computers (such as the Raspberry Pi, BeagleBoard and PandaBoard). Discussions involving Arduino, plug computers and other micro-controller like devices are also welcome.

Notices



Reply
 
Search this Thread
Old 05-01-2013, 07:19 AM   #1
elico
Member
 
Registered: Dec 2011
Posts: 115

Rep: Reputation: Disabled
C code on Linux Boards


Hi all
I am confused ,

In case i want to use a linux board like
PandaBoard that works under linux ,
Can i write C code compile to the target
and run this code on the board , or I have
to write LINUX code ?

Elico
 
Old 05-01-2013, 10:02 AM   #2
crosstalk
Member
 
Registered: Jul 2010
Distribution: Gentoo, Debian, Mint, Xubuntu
Posts: 150

Rep: Reputation: 35
Linux is a kernel/OS (depending on who you ask), not a programming language. If a computer is running Linux, then it can run C code.
 
1 members found this post helpful.
Old 05-01-2013, 10:34 AM   #3
elico
Member
 
Registered: Dec 2011
Posts: 115

Original Poster
Rep: Reputation: Disabled
What a command like fork()
is it a C command that runs under linux ?

Elico
 
Old 05-01-2013, 02:37 PM   #4
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
The standard C library defines a standard set of functions that can be expected in a conforming compiler implementation. AFAIK, this does not include fork() or any OS-specific functions. The compiler (toolchain, to be more correct) that you would use to compile C code for your target board must know about the target architecture in order to correctly compile code for the target. If the toolchain was built for your target, then object code generated for the target host by compiling C source code should run. The toolchain may be either a native toolchain, or a cross toolchain (compile on x86, run object code on Panda Board), but in either case, it needs to be specifically targeted to the runtime host.

--- rod.
 
1 members found this post helpful.
Old 05-02-2013, 04:25 AM   #5
elico
Member
 
Registered: Dec 2011
Posts: 115

Original Poster
Rep: Reputation: Disabled
So what is needed to include OS-specific functions like fork() in the code ?
Do i need to INCLUDE some OS specific header files at the start of the C code ?

Elico
 
Old 05-02-2013, 10:17 AM   #6
crosstalk
Member
 
Registered: Jul 2010
Distribution: Gentoo, Debian, Mint, Xubuntu
Posts: 150

Rep: Reputation: 35
Yes. If you run the command "man fork" ("man" is a documentation system distributed with just about every modern Unix OS), you'll see that the required include line for the fork() system call is is:

Code:
#include <unistd.h>
 
1 members found this post helpful.
Old 05-02-2013, 11:20 AM   #7
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 870
Blog Entries: 2

Rep: Reputation: 219Reputation: 219Reputation: 219
Quote:
Originally Posted by elico View Post
What a command like fork()
is it a C command that runs under linux ?
A common subject in the comp.lang.c FAQ is distinguishing between the language and platform-specific aspects of programming.
 
1 members found this post helpful.
Old 05-02-2013, 03:03 PM   #8
elico
Member
 
Registered: Dec 2011
Posts: 115

Original Poster
Rep: Reputation: Disabled
Many thanks you all
you mede it clear !

Elico
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
New to the boards...student Linux user turbo_spool LinuxQuestions.org Member Intro 3 10-21-2007 03:17 PM
Linux on NForce Boards? carlosinfl Linux - Hardware 1 02-17-2007 09:45 PM
Linux and PC104 Boards SCSUVulcan Linux - General 3 11-15-2006 06:05 PM
Linux MICRO ATX Boards? FrankGant Linux - Hardware 4 11-30-2005 04:38 PM
linux boards bogler General 5 02-19-2003 06:41 PM


All times are GMT -5. The time now is 04:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration