flat assembler
Message board for the users of flat assembler.

Index > Windows > libs in FASM

Author
Thread Post new topic Reply to topic
Snowbit



Joined: 17 Mar 2004
Posts: 3
Snowbit 17 Mar 2004, 12:19
Hi,
I programmed in Masm, and now I am trying to use fasm...
Does fasm has 'includelib' analog? I have a library, compiled with masm and want to link it with my project without code rewriting.
Is it possible?
Post 17 Mar 2004, 12:19
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 17 Mar 2004, 14:38
Well, AFAIK, it is the linker job to link library to your COFF files. You have to read FASM manual for COFF format directives.
Post 17 Mar 2004, 14:38
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Snowbit



Joined: 17 Mar 2004
Posts: 3
Snowbit 17 Mar 2004, 14:58
It means that I must write all project as COFF and then link it to EXE (for example with GoAsm)?
But can I link library without it (in PE Format)?
Post 17 Mar 2004, 14:58
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 17 Mar 2004, 15:06
Snowbit wrote:
But can I link library without it (in PE Format)?


No, you can't - you can build PE directly and use only source level libraries, or create COFF and link with external linker. IMHO, it is not a big problem to convert masm sources to FASM and to include them in the project.

Regards.
Post 17 Mar 2004, 15:06
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Vortex



Joined: 17 Jun 2003
Posts: 318
Vortex 17 Mar 2004, 18:57
Snowbit,

You can link easly Fasm COFF object files with MS Link, Pelle's linker or GoLink. Have a look at these threads for some examples:

http://board.flatassembler.net/topic.php?t=588

http://board.flatassembler.net/topic.php?t=479

_________________
Code it... That's all...
Post 17 Mar 2004, 18:57
View user's profile Send private message Visit poster's website Reply with quote
Snowbit



Joined: 17 Mar 2004
Posts: 3
Snowbit 18 Mar 2004, 07:41
It is bad Sad.
Yes, it isn't big problem to convert masm sources to FASM, but converting over 1000 lines of code isn't right way for me...
Anyway, thx for answers Smile
Post 18 Mar 2004, 07:41
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3499
Location: Bulgaria
JohnFound 18 Mar 2004, 09:56
Snowbit wrote:
It is bad Sad.


Well, as I wrote in the post above (and Vortex too), you still can compile to COFF with FASM and link it with every other COFF, LIB, even HLL generated.

Note, that direct PE creation is option that you can't get with MASM at all. Actually, I know only two assemblers that can directly create PE executables - FASM and RosAsm.

Regards.
Post 18 Mar 2004, 09:56
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
Vortex



Joined: 17 Jun 2003
Posts: 318
Vortex 18 Mar 2004, 10:58
Hi JohnFound,

There is also the Sphinx C-- compiler which is able to create directly PE files without the need of an external linker.

C-- is a hybrid of C and asm languages.

_________________
Code it... That's all...
Post 18 Mar 2004, 10:58
View user's profile Send private message Visit poster's website Reply with quote
donn



Joined: 05 Mar 2010
Posts: 321
donn 05 Jul 2016, 20:51
This is a very old thread, but I was looking for an answer on the same topic.

I have a COFF written in fasm which contains a couple incs with functions that become exported. I'm curious if there is a way to import these into a fasm PE similar to how DLL functions are imported. That way, I could continue building out more COFF functions and minimally supplement the functions with an extra import signature.

I've tried a few things, but not sure if I'm on the wrong track here.


Thanks a lot, will keep researching
Post 05 Jul 2016, 20:51
View user's profile Send private message Reply with quote
bitRAKE



Joined: 21 Jul 2003
Posts: 4020
Location: vpcmpistri
bitRAKE 06 Jul 2016, 01:52
There are a number of solutions:

A. Build a DLL from COFF functions, and import these into existing PE at runtime.
B. Convert PE to COFF, and use a linker to merge all COFF to final PE.
(As stated in this thread above.)

Good luck on your project.
Post 06 Jul 2016, 01:52
View user's profile Send private message Visit poster's website Reply with quote
donn



Joined: 05 Mar 2010
Posts: 321
donn 06 Jul 2016, 15:04
Got it, thanks!

C:\Users\Folder>link /SUBSYSTEM:WINDOWS /ENTRY:start executableName.OBJ coffName.obj "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\User32.Lib
" "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.1A\Lib\Kernel32.Lib"
Microsoft (R) Incremental Linker Version 14.00.23026.0
Copyright (C) Microsoft Corporation. All rights reserved.

Very quick too, just an extra extrn to re-import the function labels.

Appreciated
Post 06 Jul 2016, 15:04
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-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.