flat assembler
Message board for the users of flat assembler.

Index > Windows > NVCUDA.DLL - making import 64 bits libs

Author
Thread Post new topic Reply to topic
catafest



Joined: 05 Aug 2010
Posts: 120
catafest
I try to deal with 64 bits messages but I got this error:
Code:
    if defined name#.redundant        

The error gone if I add under
Code:
section '.idata' import data readable writeable

  library kernel32
        ...
        cuda,'NVCUDA.DLL'        

Can somebody tell me what happend ?
This is the source code :
Code:
format PE64 GUI 5.0     
entry start

include 'win64a.inc'


section '.text' code readable executable

  start:
          push  rbp
          lea  rdi,[Message]
           cld
           mov  rax,'--------'    
... 
         stosq
           mov  al,10
         stosb

        invoke  MessageBox,NULL,Message,NULL,MB_OK   
    
Post 30 Mar 2014, 16:47
View user's profile Send private message Visit poster's website Yahoo Messenger Reply with quote
tthsqe



Joined: 20 May 2009
Posts: 724
tthsqe
It is probably failing because you need to define the label 'cuda'
FASM is no way pre-aware of the functions in nvcuda.dll
http://board.flatassembler.net/topic.php?t=13293

my source file
Code:
...

section '.idata' import data readable writeable

  library kernel32,'KERNEL32.DLL',\
          user32,'USER32.DLL',\
          msvcrt,'MSVCRT.DLL',\
          cuda,'NVCUDA.DLL'

  include 'api\kernel32.inc'
  include 'api\user32.inc'
  include 'api_cuda.inc'

 import msvcrt,\
        sprintf,'sprintf'                          
    


api_cuda.inc:
Code:
 import cuda,\
        cuArray3DCreate,"cuArray3DCreate",\
        cuArray3DGetDescriptor,"cuArray3DGetDescriptor",\
        cuArrayCreate,"cuArrayCreate",\
        cuArrayDestroy,"cuArrayDestroy",\
        cuArrayGetDescriptor,"cuArrayGetDescriptor",\
        cuCtxAttach,"cuCtxAttach",\
        cuCtxCreate,"cuCtxCreate",\
        cuCtxDestroy,"cuCtxDestroy",\
        cuCtxDetach,"cuCtxDetach",\
        cuCtxGetDevice,"cuCtxGetDevice",\       
...    
Post 30 Mar 2014, 17:39
View user's profile Send private message Reply with quote
catafest



Joined: 05 Aug 2010
Posts: 120
catafest
@tthsqe: yes . is your code ... I don't trying to steal your code . I try to understand how is working when return messages ( I make one by one your steps).
The problem came when I don't use the label .
In this example I use label . If I remove it will got error - I just used sprints function:
Code:
format PE64 GUI 5.0
entry start

include 'win64a.inc'

section '.text' code readable executable

  start:
          push  rbp
          lea  rdi,[Message]
           cld
           mov  rax,'--------'
         stosq
           mov  rax,'oats:  x'
         stosq
           mov  rax,'   lg2.a'
         stosq
           mov  rax,'pprox.f3'
         stosq
           mov  rax,'2(x)    '
         stosq
           mov  rax,'fyl2x(x,'
         stosq
           mov  rax,'1.0)x   '
         stosq
           mov  al,10
         stosb

        invoke  MessageBox,NULL,Message,NULL,MB_OK

        invoke  ExitProcess,0

.Print:
           mov  rdx,[rbx+0]
           mov  qword[Message+0],rdx
           mov  rdx,[rbx+8]
           mov  qword[Message+8],rdx
           mov  edx,[rbx+16]
           mov  dword[Message+16],edx
           mov  byte[Message+19],10

           mov  rdx,[rax+0]
           mov  qword[Message+20],rdx
           mov  rdx,[rax+8]
           mov  qword[Message+28],rdx
           mov  rdx,[rax+16]
           mov  qword[Message+36],rdx
           mov  rdx,[rax+24]
           mov  qword[Message+44],rdx
           mov  rdx,[rax+32]
           mov  qword[Message+52],rdx
           mov  edx,[rax+40]
           mov  dword[Message+60],edx
           mov  byte[Message+62],0

        invoke  MessageBox,NULL,Message,NULL,MB_OK
        invoke  ExitProcess,0

section '.data' data readable writeable

align 16

  Message rb 50*60

section '.idata' import data readable writeable

  library kernel32,'KERNEL32.DLL',\
          user32,'USER32.DLL',\
          msvcrt,'MSVCRT.DLL',\
          cuda,'NVCUDA.DLL'

  include 'api\kernel32.inc'
  include 'api\user32.inc'

  import msvcrt,\
        sprintf,'sprintf'    
Post 31 Mar 2014, 14:15
View user's profile Send private message Visit poster's website Yahoo Messenger 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-2020, Tomasz Grysztar.

Powered by rwasa.