flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Ultraplayer 12 Aug 2021, 11:02
I am trying to convert the pascal code for a .DLL library.
Pascal version: Code: function luaopen_random(L: lua_State): Integer; cdecl; begin // ... skipped... Result := 1; end; Disassembler C++ version: Code: signed int __cdecl luaopen_random(int a1) { signed int v1; // eax return 1; } I found this topic about ccall directive, but FASM say - Extra character on line. My INCORRECT ver: Code: proc ccall luaopen_random L: DWORD mov eax, 1 endp ; <<-- [Error] Extra character on line How to make it properly? |
|||
![]() |
|
revolution 12 Aug 2021, 11:18
Something like this maybe?
Code: include 'win32ax.inc' proc luaopen_random ccall, L mov ecx, [L] mov eax, 1 ret endp |
|||
![]() |
|
revolution 12 Aug 2021, 20:27
There is a mistake. Change ccall to c
Code: include 'win32ax.inc' proc luaopen_random c, L mov ecx, [L] mov eax, 1 ret endp ccall luaopen_random |
|||
![]() |
|
Ultraplayer 12 Aug 2021, 20:37
revolution wrote: There is a mistake. Change ccall to c It works! Thank you! |
|||
![]() |
|
Roman 15 Aug 2021, 14:43
revolution wrote: proc luaopen_random c, L And how in this case proc get params c and L ? |
|||
![]() |
|
revolution 15 Aug 2021, 15:25
c isn't a parameter, it is a modifier to make it a ccall function.
To read L: mov ecx, [L] Call it with: ccall luaopen_random, my_L_value |
|||
![]() |
|
Roman 16 Aug 2021, 03:33
Ccall luaopen_random, param.
This is work only for 32 bit? |
|||
![]() |
|
revolution 16 Aug 2021, 04:01
For DLLs in Windows 64-bit you need to use fastcall to make it standard.
If you want to use ccall in Windows then you can, but you need to make your own macros and things to support it. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.