flat assembler
Message board for the users of flat assembler.

Index > Windows > Create DLL with fasm

Author
Thread Post new topic Reply to topic
yq8



Joined: 08 May 2015
Posts: 15
yq8 23 Jan 2017, 00:11
Hello Community,

I am relatively new to fasm and I like to make a little project.
My vision is to create a DLL file with fasm which has two basic functions.
And addition function and a multiplication function.
Both function should accept two integer values and return the result, something like this :

Code:
static int Addition(int a, int b)
{ 
return a+b; 
}

static int Multiplication(int a, int b)
{ 
return a*b; 
}
    


Later on I want to call the DLL from C# by using PInvoke/DLLImport.
Furthermore I want the DLL to work on both, x86 and x64 systems, - so I guess it needs to be built using x86 commands/registers, right (?)

Can someone give me some resources (not the finals solution please otherwise I won't learn anything) to get started to build a small DLL only with the stuff I need.

I hope to hear from you Smile

-yq8dev
Post 23 Jan 2017, 00:11
View user's profile Send private message Reply with quote
Trinitek



Joined: 06 Nov 2011
Posts: 257
Trinitek 23 Jan 2017, 01:53
If you want to target x86 and x64, you're going to want to write 32-bit code. You'll find a DLL example in the Examples\DLL folder. It includes the source for a DLL, and the source for an EXE that imports it. That should get you off the ground.
Post 23 Jan 2017, 01:53
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.