flat assembler
Message board for the users of flat assembler.

Index > Windows > Question about 64 bit windows and dlls.

Author
Thread Post new topic Reply to topic
rxantos



Joined: 19 Jul 2008
Posts: 41
rxantos 22 Jun 2009, 15:48
Lets say a 64 bit program that wants to use a third party dll in which you have no code only header, lib and dll.

I suppose that by creating a 32 bit executable, linked with a dll, and then use it to relay the calls from the 64 bit program to the 32 bit dll and vice-versa, it would work. The question is what is the most efficient way to do this?

Also, Is there a way to create a shared block of memory between a 64 bit process and a 32 bit process?

Does anybody has any links that explains how to do this 2 things?
Post 22 Jun 2009, 15:48
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 22 Jun 2009, 16:04
Quote:

Also, Is there a way to create a shared block of memory between a 64 bit process and a 32 bit process?

Yes, it is possible.

How often the 32- and 64-bit code will call each other? If you really need a 64-bit app then ok, but otherwise verify that you will really get something of this, because the performance hit to implement this is not small.
Post 22 Jun 2009, 16:04
View user's profile Send private message Reply with quote
asmcoder



Joined: 02 Jun 2008
Posts: 784
asmcoder 22 Jun 2009, 23:56
[content deleted]


Last edited by asmcoder on 14 Aug 2009, 14:50; edited 1 time in total
Post 22 Jun 2009, 23:56
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 23 Jun 2009, 00:45
No, you are mixing concepts here. A 64-bit process CAN'T call a 32-bit DLL directly, even if you manage to load a 32-bit executable image into a 64-bit process the processors will misinterpret the 32-bit code as a 64-bit one. What it is true is that the processor provides the so called "compatibility mode" inside long mode, that one allows to run 32-bit processes on a 64-bit environment (like Win95 allows to execute 16-bit code on a 32-bit environment).
Post 23 Jun 2009, 00:45
View user's profile Send private message Reply with quote
asmcoder



Joined: 02 Jun 2008
Posts: 784
asmcoder 23 Jun 2009, 02:13
[content deleted]


Last edited by asmcoder on 14 Aug 2009, 14:50; edited 1 time in total
Post 23 Jun 2009, 02:13
View user's profile Send private message Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4624
Location: Argentina
LocoDelAssembly 23 Jun 2009, 03:24
nop, long mode:
AMD64 Architecture Programmer’s Manual Volume 2: System Programming wrote:
Long mode consists of two submodes: 64-bit mode and
compatibility mode. 64-bit mode supports several new features,
including the ability to address 64-bit virtual-address space.
Compatibility mode provides binary compatibility with existing
16-bit and 32-bit applications when running on 64-bit system
software.


And talking about real mode, when the processor is in long mode it does not provide support for V86 mode. Executing DOS programs requires using DOSBox or any other emulator since the "compatibility mode" sub-mode does not provide support for this.
Post 23 Jun 2009, 03:24
View user's profile Send private message Reply with quote
asmcoder



Joined: 02 Jun 2008
Posts: 784
asmcoder 23 Jun 2009, 13:41
[content deleted]


Last edited by asmcoder on 14 Aug 2009, 14:50; edited 1 time in total
Post 23 Jun 2009, 13:41
View user's profile Send private message Reply with quote
Borsuc



Joined: 29 Dec 2005
Posts: 2465
Location: Bucharest, Romania
Borsuc 23 Jun 2009, 15:47
Must 32-bit code run on another core than 64-bit, or how does the OS switch between them when running different processes?

_________________
Previously known as The_Grey_Beast
Post 23 Jun 2009, 15:47
View user's profile Send private message Reply with quote
asmcoder



Joined: 02 Jun 2008
Posts: 784
asmcoder 23 Jun 2009, 17:28
[content deleted]
Post 23 Jun 2009, 17:28
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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.