Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Help with a C wrapper.

Hello Im fairly new to assembly.
Here is my problem. I have to write a simple ARM program to add a few numbers and print the sum. I am able to do that. But according to the instructor we need a C wrapper to print the sum. here is what he gave us to help:

For the homework, you can use a 'c' wrapper to print the output. So a typical c program will look like the following. So if sum5, is your program, the c code would look like this.

x = sum5();
printf("The answer is %d
", x);


the problem is we haven't done any C programming yet, only java.

so we have tried many things but cannot get the "wrapper" to compile.
we have emailed him and posted on the class message board asking for clarification but he keeps just posting similar code.

Comments

  • BitByBit_ThorBitByBit_Thor Member Posts: 2,444
    : Hello Im fairly new to assembly.
    : Here is my problem. I have to write a simple ARM program to add a
    : few numbers and print the sum. I am able to do that. But according
    : to the instructor we need a C wrapper to print the sum. here is
    : what he gave us to help:
    :
    : For the homework, you can use a 'c' wrapper to print the output. So
    : a typical c program will look like the following. So if sum5, is
    : your program, the c code would look like this.
    :
    : x = sum5();
    : printf("The answer is %d
    ", x);
    :
    :
    : the problem is we haven't done any C programming yet, only java.
    :
    : so we have tried many things but cannot get the "wrapper" to compile.
    : we have emailed him and posted on the class message board asking for
    : clarification but he keeps just posting similar code.
    :

    Have you tried:
    [code]
    #include

    int main()
    {
    int x = sum5();
    printf("The answer is %d
    ", x);

    return 0;
    }
    [/code]

    This should compile. However, you will need to add your assembly file to the project, or atleast make sure the linker knows where to find the compiled assembly object.

    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
  • jsk07jsk07 Member Posts: 2
    : : Hello Im fairly new to assembly.
    : : Here is my problem. I have to write a simple ARM program to add a
    : : few numbers and print the sum. I am able to do that. But according
    : : to the instructor we need a C wrapper to print the sum. here is
    : : what he gave us to help:
    : :
    : : For the homework, you can use a 'c' wrapper to print the output. So
    : : a typical c program will look like the following. So if sum5, is
    : : your program, the c code would look like this.
    : :
    : : x = sum5();
    : : printf("The answer is %d
    ", x);
    : :
    : :
    : : the problem is we haven't done any C programming yet, only java.
    : :
    : : so we have tried many things but cannot get the "wrapper" to compile.
    : : we have emailed him and posted on the class message board asking for
    : : clarification but he keeps just posting similar code.
    : :
    :
    : Have you tried:
    : [code]:
    : #include
    :
    : int main()
    : {
    : int x = sum5();
    : printf("The answer is %d
    ", x);
    :
    : return 0;
    : }
    : [/code]:
    :
    : This should compile. However, you will need to add your assembly
    : file to the project, or atleast make sure the linker knows where to
    : find the compiled assembly object.
    :
    : Best Regards,
    : Richard
    :
    : The way I see it... Well, it's all pretty blurry

    thanks buddy, we figured it out in the meantime a slightly different way
Sign In or Register to comment.