The MASM Forum

General => The Campus => Topic started by: avcaballero on November 18, 2015, 08:15:29 PM

Title: Sharing data between dll and our process
Post by: avcaballero on November 18, 2015, 08:15:29 PM
Hello, I am dealing with dll examples and I have a trouble with sharing data between dll and my process. I have avoiding the problems as the encapsulating OOP, calling a routine in the dll that tells us the value of this variable. But I know there are ways to doing it using dll options, etc. (asm and c concerning) but for the moment I'm stuck and I have no much time, so if anyone wants to help    :P
Title: Re: Sharing data between dll and our process
Post by: jj2007 on November 18, 2015, 10:38:35 PM
Build as DLL:
include \masm32\include\masm32rt.inc

ShareLen=256*1024 ; 256k

MyData segment shared 'bss'
OneDay LABEL BYTE
  ORG $+ShareLen-1
  db ?
MyData ends

.code
GetPtr2SharedMem proc ; $export
  mov eax, offset OneDay
  retn
GetPtr2SharedMem endp

LibMain proc instance:DWORD, reason:DWORD, unused:DWORD
    m2m eax, TRUE
    ret
LibMain endp

end LibMain


Sources attached.
Title: Re: Sharing data between dll and our process
Post by: avcaballero on November 18, 2015, 11:21:28 PM
Much apreciated, JJ, you're an eagle :t