Renegade Public Forums
C&C: Renegade --> Dying since 2003™, resurrected in 2024!
Home » Renegade Discussions » Mod Forum » Issue with inline assembler DLL function call
Issue with inline assembler DLL function call [message #475543] Tue, 02 October 2012 11:27 Go to next message
iRANian is currently offline  iRANian
Messages: 4308
Registered: April 2011
Karma: 0
General (4 Stars)
Inside a plugin I call Console_Input via inline assembler, the generated call is:

call    near ptr __imp_?Console_Input@@YAXPBD@Z ; Console_Input(char const *)


However, when I call that function using the normal (non-assembler) syntax, the following call is generated:

call    ds:__imp_?Console_Input@@YAXPBD@Z ; Console_Input(char const *)


If I wrap Console_Input() inside another function in my plugin and call that wrapper instead, it works correctly, I'm using the following assembler code to call Console_Input():

call Console_Input


Any suggestions? The call that's generated for the assembler code causes the fds to crash.


Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases
Re: Issue with inline assembler DLL function call [message #475552 is a reply to message #475543] Tue, 02 October 2012 14:34 Go to previous messageGo to next message
Whitedragon is currently offline  Whitedragon
Messages: 832
Registered: February 2003
Location: California
Karma: 1
Colonel
Try

call DWORD PTR Console_Input


Black-Cell.net
Network Administrator (2003 - )

DragonServ, Renegade's first IRC interface bot
Creator and lead coder (2002 - )

Dragonade, Renegade's first server side modification
Lead coder (2005 - )
Re: Issue with inline assembler DLL function call [message #475554 is a reply to message #475543] Tue, 02 October 2012 17:48 Go to previous messageGo to next message
jonwil is currently offline  jonwil
Messages: 3557
Registered: February 2003
Karma: 0
General (3 Stars)

We have run into this problem before in scripts, the simple answer is that you cant call a function that's imported from another dll inside an ASM block (at least we never found such a way)
Thats why the HookupAT3x function exists in all the SSGM plugins.


Jonathan Wilson aka Jonwil
Creator and Lead Coder of the Custom scripts.dll
Renegade Engine Guru
Creator and Lead Coder of TT.DLL
Official member of Tiberian Technologies
Re: Issue with inline assembler DLL function call [message #475563 is a reply to message #475552] Tue, 02 October 2012 23:46 Go to previous message
iRANian is currently offline  iRANian
Messages: 4308
Registered: April 2011
Karma: 0
General (4 Stars)
Whitedragon wrote on Tue, 02 October 2012 14:34

Try

call DWORD PTR Console_Input


Thanks, that works!


Long time and well respected Renegade community member, programmer, modder and tester.

Scripts 4.0 private beta tester since May 2011.

My Renegade server plugins releases
Previous Topic: destroy all vehicles
Next Topic: Dazzle
Goto Forum:
  


Current Time: Thu Nov 28 07:12:28 MST 2024

Total time taken to generate the page: 0.00592 seconds