Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2008-12

What is CreateFileMapping?

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Gilles MARCOU

Hi,

I am converting a small project from Delphi to Free Pascal. I am working on a Linux (Debian) box. In several places, the software seems to call to external applications an uses this kind of command:

var
  smfMemHnd : HWND;
...
smfMemHnd := CreateFileMapping(HWND($FFFFFFFF), nil, PAGE_READWRITE, 0,
memFileSize , memFileName);

Free Pascal seems unable to find the function CreateFileMapping. While browsing the RTL, this function seems to be part of some Windows related library.

I have two questions:

1/ Which unit shall I add to my .pas file for FPC to find this function? 2/ If this is Windows specific, how do I manage this on other architectures?

thanks in advance for your help,
Gilles Marcou

Reply by email

Jonas Maebe
to Gilles MARCOU
Gilles MARCOU wrote 23 lines
I am converting a small project from Delphi to Free Pascal. I am working on a Linux (Debian) box. In several places, the software seems to call to external applications an uses this kind of command: var smfMemHnd : HWND; ... smfMemHnd := CreateFileMapping(HWND($FFFFFFFF), nil, PAGE_READWRITE, 0, memFileSize , memFileName); Free Pascal seems unable to find the function CreateFileMapping. While browsing the RTL, this function seems to be part of some Windows related library. I have two questions: 1/ Which unit shall I add to my .pas file for FPC to find this function? 2/ If this is Windows specific, how do I manage this on other architectures?

It is Windows-specific. On *nix platforms (such as Linux), you can probably use fpmmap instead (it's in the baseunix unit). See http://www.freepascal.org/docs-html/rtl/baseunix/fpmmap.html , or "man mmap", for more information. Note that it expects a file descriptor rather than a file name (but there's an example program on that page that demonstrates how to use it).

Jonas

Reply by email