Showing results 1 to 3 of 3

Thread: OnlineVariable.SetMemCfg & WriteBack

  1. #1
    Join Date
    25.10.2012
    Posts
    2

    Default OnlineVariable.SetMemCfg & WriteBack

    Ladies & Gentlemen,

    to speed up value updating in SICAM230 I'm trying to implement shared memory access to SICAM230.

    OnlineVariable.SetMemCfg uses as it's first argument a name for the shared memory area:

    VARIANT_BOOL SetMemCfg(
    BSTR szMemName,
    SAFEARRAY(BSTR)* szPvNames,
    SAFEARRAY(long)* lOffsets,
    VARIANT_BOOL bAsRawValue);

    How does this name refer to the name of the mapping object needed for the C function? Using just the same name does not work.

    sharedMemoryMutex = CreateMutex(NULL,
    FALSE,
    szName); // name of mapping object

    What is the meaning of the SetMemCfg return value? Currently I'm obtaining "false".

    Any ideas and hints (and sample source codes ;-) are urgently welcome!

    Best regards,

    Christian.

  2. #2
    Join Date
    25.10.2012
    Posts
    2

    Default Re: OnlineVariable.SetMemCfg & WriteBack

    Got it working. The essentials are:
    CreateFileMapping(0, NULL, PAGE_READWRITE, 0, BUF_SIZE, "SHARE.MEMORY");
    sharedMemoryMap = (BYTE*) MapViewOfFile(sharedMemoryFile, FILE_MAP_ALL_ACCESS, 0, 0, 0);
    memset(sharedMemoryMap, 0, BUF_SIZE);
    sharedMemoryMutex = CreateMutex(NULL, FALSE, "SHARE.MUTEX");
    
    m_pOnlineVariables = m_pProject->OnlineVariables();
    m_pOnlineVariable = m_pOnlineVariables->CreateOnlineVariables(_bstr_t("VARIABLES"));
    m_pOnlineVariable->SetMemCfg(_bstr_t("SHARE"), &m_pArrayNames, &m_pArrayOffsets, USERAW);
    Have fun!

  3. #3
    martins Gast

    Default Re: OnlineVariable.SetMemCfg & WriteBack

    hi,

    thanks for the feedback. I messed around a little bit myself but I could not get it working

    best regards,
    Martin

Similar Threads

  1. CD_DotNetControlContainer & Form
    By stolyarov_as in forum VSTA
    Replies: 0
    Last Post: 24th January 2012, 12:36
  2. Replies: 1
    Last Post: 5th October 2011, 15:49
  3. P&F Scheduler
    By hansvanzijp in forum zenon Supervisor
    Replies: 5
    Last Post: 12th January 2010, 10:09
  4. Replies: 5
    Last Post: 16th July 2009, 14:39
  5. RunTime & Schedule
    By rloureiro in forum zenon Supervisor
    Replies: 2
    Last Post: 1st April 2008, 12:10

Posting Rules

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •