Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. i can not pass CStringArray from dll

i can not pass CStringArray from dll

Scheduled Pinned Locked Moved C / C++ / MFC
c++
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vc programmer 1
    wrote on last edited by
    #1

    i can not pass CStringArray from dll.... my dll code here................... My.h ---- MY_API CStringArray MyName; MY_API void GetmyName(CStringArray _myname); My.cpp ------ MY_API void GetmyName(CStringArray _myname) { for(int i=0;i

    S B 2 Replies Last reply
    0
    • V vc programmer 1

      i can not pass CStringArray from dll.... my dll code here................... My.h ---- MY_API CStringArray MyName; MY_API void GetmyName(CStringArray _myname); My.cpp ------ MY_API void GetmyName(CStringArray _myname) { for(int i=0;i

      S Offline
      S Offline
      Selvam R
      wrote on last edited by
      #2

      Hi, Nice discussion about Pass CStringArray to DLL, http://www.codeproject.com/dll/RegDLL.asp#xx1016379xx[^] Regards, Selvam

      1 Reply Last reply
      0
      • V vc programmer 1

        i can not pass CStringArray from dll.... my dll code here................... My.h ---- MY_API CStringArray MyName; MY_API void GetmyName(CStringArray _myname); My.cpp ------ MY_API void GetmyName(CStringArray _myname) { for(int i=0;i

        B Offline
        B Offline
        Blake Miller
        wrote on last edited by
        #3

        --OR-- Pass the CStringArray address instead of a COPY of the entire string array :doh: MY_API CStringArray MyName; MY_API void GetmyName(CStringArray* _myname); My.cpp ------ MY_API void GetmyName(CStringArray* _myname) { for(int i=0;i { _myname->Add(MyName.GetAt(i)); } } typedef void (*EXTERNAL_NAME) (CStringArray* _myname); EXTERNAL_NAME dll_myname; ---- --- -- -- CStringArray aa; dll_myname(&aa); for(int i=0;i { m_ist.AddString(aa.GetAt(i)); }

        V 1 Reply Last reply
        0
        • B Blake Miller

          --OR-- Pass the CStringArray address instead of a COPY of the entire string array :doh: MY_API CStringArray MyName; MY_API void GetmyName(CStringArray* _myname); My.cpp ------ MY_API void GetmyName(CStringArray* _myname) { for(int i=0;i { _myname->Add(MyName.GetAt(i)); } } typedef void (*EXTERNAL_NAME) (CStringArray* _myname); EXTERNAL_NAME dll_myname; ---- --- -- -- CStringArray aa; dll_myname(&aa); for(int i=0;i { m_ist.AddString(aa.GetAt(i)); }

          V Offline
          V Offline
          vc programmer 1
          wrote on last edited by
          #4

          great! this work ... but i have problem.. i accepted result and then error appear... i don't know what happen.. Debug Assertion Failed Program:debug\My.exe File:dbgheap.c Line:1011 Expression:_CrtIsValidHeapPointer(pUserData) Debug Assertion Failed Program:debug\My.exe File:dbgheap.c Line:1076 Expression:_pFirstBlock(pHead) Application Error The instruction at "0x10008ba5" refrenced memory at "0xddddddf1":The memory could not be "read".

          B 1 Reply Last reply
          0
          • V vc programmer 1

            great! this work ... but i have problem.. i accepted result and then error appear... i don't know what happen.. Debug Assertion Failed Program:debug\My.exe File:dbgheap.c Line:1011 Expression:_CrtIsValidHeapPointer(pUserData) Debug Assertion Failed Program:debug\My.exe File:dbgheap.c Line:1076 Expression:_pFirstBlock(pHead) Application Error The instruction at "0x10008ba5" refrenced memory at "0xddddddf1":The memory could not be "read".

            B Offline
            B Offline
            Blake Miller
            wrote on last edited by
            #5

            Make sure the two files are matched as to their debug versus release builds. You will get this very commonly if you built your DLL as DEBUG and your EXE as Release and then run them against each other. The debug build's memory allocator will add extra memory checking data at head and tail of memory blocks, and the release build's memory allocator does not expect this extra data to be there. Likewise, if memory is allocated by a release build and tested by a debug build, it fails because the memory block's header data appears to be corrupted.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups