[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4762: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4764: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4765: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4766: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3897)
newlispfanclub.alh.net • View topic - (share) with (pack) memory

(share) with (pack) memory

Q&A's, tips, howto's

(share) with (pack) memory

Postby hds1 » Sun Jan 07, 2018 9:44 am

it seems not possible to use (share) with packed elements.
i.e.
(set 'flash (share))
(share flash (pack (dup "u" 10) (sequence 1 10)))

According to the docs (share) should work with any newlisp expression.

When forking processes and calling C-libs from these processes it would be nice to be able to set the (share) in the parent process without the neccessity to repack it in the child process.

Or do i miss something obvious here ?
Regards
Heiko
hds1
 
Posts: 27
Joined: Thu Mar 20, 2014 5:02 pm

Re: (share) with (pack) memory

Postby Lutz » Tue Jan 09, 2018 5:28 pm

Lutz
 
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California

Re: (share) with (pack) memory

Postby hds1 » Thu Jan 11, 2018 12:52 pm

hm, i meant reading the (shared memory) from a C-lib.
i.e.
Parent <-> (share mem) <-> Forked child (calling the C-lib)
Parent:
(set 'flashMemory (share))
(share flashMemory (rand 0xFFFF 100))

Forked Child:
(emulavr_load_flash (pack (dup "u" 100) flashMemory))

C-lib prints rubbish numbers:
ubyte * emulavr_load_flash(ubyte * flash_prom) {
printf("EMULAVR FLASH intro: 0x%04X 0x%04X\n", flash_prom[0],flash_prom[1]);
}
hds1
 
Posts: 27
Joined: Thu Mar 20, 2014 5:02 pm

Re: (share) with (pack) memory

Postby Lutz » Sat Jan 13, 2018 3:26 pm

Lutz
 
Posts: 5279
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California


Return to newLISP in the real world

Who is online

Users browsing this forum: No registered users and 1 guest

cron