All of lore.kernel.org
 help / color / mirror / Atom feed
From: fabio <fabio@crearium.com>
To: linux-c-programming@vger.kernel.org
Subject: MIsc C programming questions
Date: Mon, 24 Oct 2005 03:02:43 -0600	[thread overview]
Message-ID: <435CA333.3010904@crearium.com> (raw)

Hello,

I have some questions about C programming not exactly on Linux but
Solaris, I hope you can help me:

- Why I cant include this __asm___ lines on a C program and compile it
on Sun cc on Solaris 10?

-bash-3.00$ cat ret.c; cc ret.c
/*

*/

#include <stdio.h>
#include <stdlib.h>
#include <sys/systeminfo.h>


/*
*
*/
int
main() {
    int ret;
    ret = get_sp();
    printf("Stack Pointer is: 0x%x\n",ret);
    char platform[257],release[257];
    sysinfo(SI_PLATFORM, platform, sizeof(platform) - 1);
    sysinfo(SI_RELEASE, release, sizeof(release) - 1);
    printf("Platform: %s (%s)\n", platform, release);
    return (EXIT_SUCCESS);
}

int
get_sp(){
    __asm__("mov %sp,%g1");
    __asm__("mov %g1,%o1");
}
"ret.c", line 16: warning: implicit function declaration: get_sp
"ret.c", line 27: warning: implicit function declaration: __asm__
Undefined                       first referenced
symbol                             in file
__asm__                             ret.o
ld: fatal: Symbol referencing errors. No output written to a.out
-bash-3.00$

Any workaround?

Thanks


             reply	other threads:[~2005-10-24  9:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-24  9:02 fabio [this message]
2005-10-24 10:02 ` MIsc C programming questions Steve Graegert

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=435CA333.3010904@crearium.com \
    --to=fabio@crearium.com \
    --cc=linux-c-programming@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.