1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

C++ Excel Function causes crash when linked to random cells

Discussion in 'Software Development' started by mcmcman, Sep 15, 2003.

Thread Status:
Not open for further replies.
  1. mcmcman

    mcmcman Thread Starter

    Joined:
    Sep 15, 2003
    Messages:
    2
    Hi,

    I have written a Multivariate Normal C++ function and exported it into a DLL so that I can use it in my VBA Programs. In addition, I have written a VBA function that allows me to use the multivariate Normal function in my Excel spreadsheets.

    The function works fine as long as it is linked to only non-random cells. If I try linking it to random cells, however, the function only works if the cells are made random after the links are established. If the cells are random at the time I enter my function, Excel crashes. The following illustrates the dependence on the order in which the functions are entered.

    Linking Method A: (Works)

    1. My function is entered into cell A3 and is linked to cells A1 and A2, where A1 contains the number 0 and A2 the number 1

    2. The rand() function is entered into cells A1 and A2

    My function produces the desired results and can be refreshed using the F9 key

    Linking Method B: (Does not Work)

    1. The rand() function is entered into cells A1 and A2
    2. My function is entered into cell A3 and is linked to cells A1 and A2.

    The entry of my function into cell A3 causes Excel to crash...

    I have tried a number of different things but have been unable to figure out why this dependence exists. I think it must have something to do with how excel sets up its links between the different cells. I am hoping to create an add-in that uses the function and want to avoid these crashes.

    Does anyone have an idea of how I can get around this problem?

    Additional information:

    The Multivariate normal C++ function takes pointers to Safearrays as its arguments. In a univariate normal function, I passed pointers to doubles and the problem does not occur for that function. I can provide additional details if it would help in solving the problem.

    mcmcman
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/165002

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice