flat assembler
Message board for the users of flat assembler.

flat assembler > Windows > AMD APP linkage in MS COFF

Author
Thread Post new topic Reply to topic
donn



Joined: 05 Mar 2010
Posts: 114
Hi, I've been working with AMD APP in Visual Studio for a while now, mixing in asm objs with vid's COFF mixing style.

Was interested in calling functions such as
Code:
extrn '__imp_clGetPlatformIDs' as clGetPlatformIDs:qword    
from fasm objs and running the executable with
Code:
/SUBSYSTEM:WINDOWS  /ENTRY:start     
instead of from cpp files/Visual Studio. I'm still trying to figure this out, but progress has been very slow.

I can set the main entry point as a fasm COFF and link with cpp objs, but the AMD APP calls don't seem to execute properly. I can get valid results if I set the main entry point within the cpp objs, then call an asm COFF func that calls clGetPlatformIDs, but I can't switch the entry point completely. Windows API functions still work once switching over, but the AMD APP ones don't.

An example call that works only when the cpp files contain the executable entry point:

Code:
        lea r8, [newAPP.numPlatforms]
        mov rdx, 0
        mov rcx, 0
        stdcall [clGetPlatformIDs], rcx,rdx,r8    


or from the cpp.cpp file directly:

Code:
        cl_int status;
        cl_uint numPlatforms;
        status = clGetPlatformIDs(0, NULL, &numPlatforms);
            


As mentioned above, progress has been slow trying to get rid of these cpp files. If anyone has any ideas off the top of their head, would be greatly appreciated.
Post 18 Sep 2017, 04:26
View user's profile Send private message Reply with quote
donn



Joined: 05 Mar 2010
Posts: 114
OK nevermind, I figured it out!

Haven't run a COFF as an executable entry point with non-WINAPI .lib's before, thought I was missing a step to get this to work, or thought it might not have been possible with this .lib (AMD's APP Platform). I was questioning everything and getting quite frustrated. Turned out to just be a case of a misaligned stack...

Sorry for the convoluted post, but getting this running was a huge relief!
Post 19 Sep 2017, 02:26
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2018, Tomasz Grysztar.

Powered by rwasa.