NO

Author Topic: inline asm  (Read 7283 times)

avcaballero

  • Guest
inline asm
« on: October 31, 2009, 07:35:51 PM »
Hello, I'm new in this forum. I'd like to ask you if I can write a messagebox in windows-c. Maybe something like this?

void writemessage(void)
{
  char msg[] = "Hello world!";
  char title[] = "from POASM";
  __asm {
    push   dword  0        // ok button
    push   dword  title
    push   dword  msg
    push   dword  0
    call   MessageBoxA
  }
  exit (0);
}

Thankx

Offline Vortex

  • Member
  • *
  • Posts: 865
    • http://www.vortex.masmcode.com
Re: inline asm
« Reply #1 on: November 01, 2009, 12:28:12 PM »
Hi avcaballero,

Here is how it should go :

Code: [Select]
#include <windows.h>
#include <stdio.h>

char msg[] = "Hello world!";
char title[] = "from Pelles C";

void WriteMessage(void)
{

__asm{
push 0
push OFFSET title
push OFFSET msg
push 0
call DWORD PTR MessageBox
}

}

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
LPSTR lpCmdLine, int nCmdShow)
{
WriteMessage();
return 0;
}
Code it... That's all...

avcaballero

  • Guest
Re: inline asm
« Reply #2 on: November 07, 2009, 09:57:13 PM »
Hello. Thank you for your replay, it works fine. What I want now is to call a messagebox from c in an external PoASM module, adding it to the project.

Can I define in PoAsm the function MessageBox external?

POLINK: error: Unresolved external symbol '_MessageBox'.

Thank you

roosttylor

  • Guest
Re: inline asm
« Reply #3 on: April 01, 2015, 01:29:17 PM »
following message:
'polink fatal error(363): must be inside a section'.
This error is not listed in the Pelles C help file or in Goggle searches.
Please can anyone tell me the meaning of this error and what I need to do to resolve it?
Many thanks for your help.