Author Topic: Printing number to screen without using extern  (Read 14718 times)

Offline Roddy MacPhee

  • Jr. Member
  • *
  • Posts: 9
Printing number to screen without using extern
« on: May 27, 2024, 10:59:37 PM »
Is it possible to print a numerical value to screen without extern . How ? This came up on my previous thread...

Offline fredericopissarra

  • Full Member
  • **
  • Posts: 373
  • Country: br
Re: Printing number to screen without using extern
« Reply #1 on: May 28, 2024, 01:16:21 PM »
Is it possible to print a numerical value to screen without extern . How ? This came up on my previous thread...
A "number", printed on the screen, is just a string... Convert the number to a string and print it using some syscall or API function (in case of Windows).

Offline Roddy MacPhee

  • Jr. Member
  • *
  • Posts: 9
Re: Printing number to screen without using extern
« Reply #2 on: May 28, 2024, 04:42:06 PM »
A "number", printed on the screen, is just a string... Convert the number to a string and print it using some syscall or API function (in case of Windows).
What if the number is a loop variable ?

Offline fredericopissarra

  • Full Member
  • **
  • Posts: 373
  • Country: br
Re: Printing number to screen without using extern
« Reply #3 on: May 28, 2024, 08:13:00 PM »
What if the number is a loop variable ?
Again: Convert the number to a string and print the string...

Offline Roddy MacPhee

  • Jr. Member
  • *
  • Posts: 9
Re: Printing number to screen without using extern
« Reply #4 on: May 28, 2024, 08:18:11 PM »
Again: Convert the number to a string and print the string...
how do I convert ?

Offline fredericopissarra

  • Full Member
  • **
  • Posts: 373
  • Country: br
Re: Printing number to screen without using extern
« Reply #5 on: May 29, 2024, 12:29:31 PM »
how do I convert ?
How do you do by hand?

You have, at least, try instead asking someone to do it for you...
« Last Edit: May 29, 2024, 12:31:02 PM by fredericopissarra »

Offline Roddy MacPhee

  • Jr. Member
  • *
  • Posts: 9
Re: Printing number to screen without using extern
« Reply #6 on: May 29, 2024, 03:46:40 PM »
Looping each digit it is ... I know loops, and I know how to ascii and print normal strings to screen. Android is a bit annoying

Offline avcaballero

  • Full Member
  • **
  • Posts: 133
  • Country: es
    • Abre los Ojos al Ensamblador
Re: Printing number to screen without using extern
« Reply #7 on: June 09, 2024, 04:19:01 PM »
Hello, here an example of what you want.

Offline alCoPaUL

  • Jr. Member
  • *
  • Posts: 74
  • Country: ph
    • Webpage
Re: Printing number to screen without using extern
« Reply #8 on: June 09, 2024, 05:19:43 PM »
Use JWasm coz it has a directive called option DllExport <'insert name of the dll'> and you won't need using .lib files (and i assume that is your reason why you bluntly asked about not using externs) when making the .exe..

or maybe some assembler (NASM/TASM/MASM/whateverASM) has a funky way of putting whatever in the source code and it won't need cross linking to the library on the commandline or in the source code itself ("includelib\whatever.lib")

coz once you found out a way of not using a .lib file, your source code could literally be able to do just about anything as if it is assembled and linked..

EDIT:

i saw some reference to DLLIMPORT with NASM and GoLink and i saw that you still need the .dll files for linking.. for JWasm, i just skimmed the source code snippet containing the DLLIMPORT option in the author's GitHub and didn't check if its accompanied linker still needs to refer to the .dll files @ commandline or source..

what i'm getting at is the source code already has everything about the references to the DLL functions without needing to do symbolic link any external files like .libs and .dlls and you just go do a "link whatever.obj /subsystem:console /entry:meme" without any more switches..
« Last Edit: June 09, 2024, 06:22:06 PM by alCoPaUL »