NO

Author Topic: [SOLVED] How to "import" libraries in pure Assembly  (Read 10505 times)

typedef

  • Guest
[SOLVED] How to "import" libraries in pure Assembly
« on: September 24, 2011, 08:29:38 AM »
Hi, I want to make program in pure assembly (using poasm) and I'd like to use Windows libraries but I don't know how to link them(user32.lib kernel32.lib etc).
Can you please show me how to do a manual link, be it in the properties or hard coding it.
Thanks.

I usually use FASM for all my pure Assembly projects but I'd like to also link some C procedures(if you could also show me how that'd be cool),using PellesC IDE of course.

Here's just the small 1KB exe that does nothing,..yet!
Code: [Select]
;include '/utils/cryptoEx.inc'
;include '/utils/time.inc'
;include '/security/guard.inc'

.code

public start

start PROC  argc:DWORD,argv:DWORD

ret
start ENDP

Thanks in advance.
« Last Edit: September 24, 2011, 10:34:57 PM by typedef »

Offline TimoVJL

  • Global Moderator
  • Member
  • *****
  • Posts: 2115
Re: How to "import" libraries in pure Assembly
« Reply #1 on: September 24, 2011, 10:14:28 AM »
Quote
manual link
polink.exe xxx.obj kernel32.lib user32.lib
Quote
be it in the properties
Insert to menu Project -> Project options... -> Linker tab -> Library and object files:
In source file
Code: [Select]
INCLUDELIB "kernel32.lib"
INCLUDELIB "user32.lib"
May the source be with you

typedef

  • Guest
[SOLVED] How to "import" libraries in pure Assembly
« Reply #2 on: September 24, 2011, 10:34:32 PM »
In source file
Code: [Select]
INCLUDELIB "kernel32.lib"
INCLUDELIB "user32.lib"

Aah, thank you very much... I was looking for that.

I figured out a lot  of things yesterday as I browsed through the forums looking at other people's tutorials.

I can now link procedures from C to Assembly and vice versa using the following.


Code: [Select]
; From C to Assembly assuming function void sayHello(char *) is in a C file
.model flat,stdcall
.code
sayHello PROTO :DWORD

myProc PROC
            push text
            call   [sayHello]
ret
myProc ENDP
.data
text db 'Hello World',0

And from Assembly to C
Code: [Select]

extern  int myProc();
myProc();


Thank you all, it just gets easier everyday..
So

Offline Vortex

  • Member
  • *
  • Posts: 865
    • http://www.vortex.masmcode.com
Re: [SOLVED] How to "import" libraries in pure Assembly
« Reply #3 on: September 29, 2011, 10:18:16 AM »
I wonder what is "pure assembly" ?
Code it... That's all...

typedef

  • Guest
Re: [SOLVED] How to "import" libraries in pure Assembly
« Reply #4 on: October 01, 2011, 04:33:21 AM »
I wonder what is "pure assembly" ?
I wonder if you are a coder or not  ::)

The real coders I know wouldn't have such a stupid thought

Offline Vortex

  • Member
  • *
  • Posts: 865
    • http://www.vortex.masmcode.com
Re: [SOLVED] How to "import" libraries in pure Assembly
« Reply #5 on: October 01, 2011, 11:35:41 AM »
I wonder what is "pure assembly" ?
I wonder if you are a coder or not  ::)

The real coders I know wouldn't have such a stupid thought

First of all, who grants you the right to insult me? Thanks for your kind words! Please read the forum rules and understand that you can't use here a strong language. This forum is for civilized people.

Second : I started assembly in 1986 with a Sinclair ZX Spectrum 48K. It was the Z80 processor's era and probably I have an opinion about who is a "real coder" since 25 years...

Third : Could you post me an official article \ link explaining what is "pure assembly" ?
Code it... That's all...