Thread: Pass pointer to string data to GNU Assembler and catch it

  1. #1
    Registered User
    Join Date
    Sep 2018
    Posts
    25

    Pass pointer to string data to GNU Assembler and catch it

    Hi all!
    Please, help to understand how could I pass string from C program into GNU Assembler one and operate it in GNU Assembler. Where could I read about it detailed explanation?
    Thank you.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    38,314
    The assembler is going to read input from a file, or from stdin.

    So either
    - write your string to a temporary file, then invoke the assembler with your temp file as a command line parameter.
    - connect to the assembler using popen(), such that the assembler will read from stdin, then write your program string to the opened pipe.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Sep 2018
    Posts
    25
    Sorry, I'm afraid that I gave weak explanation. What if my assembler program asm.s and c program my.c compiled as a solid output using command gcc -shared -fpic -o lib.so my.c asm.s?

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    38,314
    What about it?

    You should be able to string together .c, .s, .o and .a files on the command line to gcc, and it will pass the relevant files onto the appropriate compilation step.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 08-24-2015, 07:43 AM
  2. Replies: 4
    Last Post: 02-14-2012, 07:45 PM
  3. need help in 2 pass assembler
    By draglord in forum C++ Programming
    Replies: 2
    Last Post: 05-01-2011, 11:50 AM
  4. Why can't throw/catch a const string
    By chenayang in forum C++ Programming
    Replies: 9
    Last Post: 03-20-2008, 08:31 AM
  5. Pass by reference vs pass by pointer
    By Non@pp in forum C++ Programming
    Replies: 10
    Last Post: 02-21-2006, 01:06 PM

Tags for this Thread