On Aug 23, 10:23 am, Equiangular <equiangu...@hotmail.com> wrote:
> The following URL gives a step by step example
>
> http://www.che.utexas.edu/cache/news...001_useofc.pdf
>
> Hope it's useful to you
>
>
>
> thekind78 wrote:
> > On Aug 23, 8:17 am, thekind78 <vijayvadlam...@hotmail.com> wrote:
> >> On Aug 23, 7:47 am, Equiangular <equiangu...@hotmail.com> wrote:
>
> >>> One point to add
> >>> You should use ByVal for the first and second parameter
> >>> The following link is quite usefulhttp://support.microsoft.com/?scid=kb%3Ben-us%3B106553&x=16&y=9
> >>> Equiangular wrote:
> >>>> use long instead of integer in vba
> >>>> long is signed 32 bit integer
> >>>> thekind78 wrote:
> >>>>> Hello all,
> >>>>> Trying to call a C++ function from VBA. Function is declared as
> >>>>> following in C++:
> >>>>> func(char[],int[],int)
> >>>>> The function reads the char*, does some manipulations on the data
> >>>>> within it, and writes the results to the int*. There are two things I
> >>>>> see as problems:
> >>>>> 1) the int values in C++ are greater than the max value permitted in
> >>>>> VBA
> >>>>> 2) not sure how to pass the parameters to the dll from VBA
> >>>>> I have been trying some combination of the following:
> >>>>> func(ByRef string, ByRef int(1), ByVal int)
> >>>>> i.e. sending down the address of the string, the address of the
> >>>>> first element of the integer array and the value of an integer which
> >>>>> corresponds to the number of iterations that are required for some
> >>>>> processing done in the C++ code. Can anyone suggest how to address the
> >>>>> two problems above? As it stands now, the code completely shuts down
> >>>>> Excel without even a warning. Some illegal memory addressing I guess
> >>>>> but not sure how to get around it. Thanks in advance.- Hide quoted text -
> >>> - Show quoted text -
> >> Equiangular,
> >> Thanks for your help. I'm still getting a Segmentation fault of sorts
> >> as Excel just shuts down. Is it necessary to register the dll before
> >> using it? Thank you.- Hide quoted text -
>
> >> - Show quoted text -
>
> > Also,
> > Is it necessary for the DLL to include a LibMain function? It
> > contains a DllEntryPoint function. Thanks for your help.- Hide quoted text -
>
> - Show quoted text -
Equiangular,
Thanks for your help.