dcsimg
Results 1 to 2 of 2

Thread: export VB function to C

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2006
    Posts
    78

    export VB function to C

    Hi,
    I have a time critical routine in my application which is taking most of the CPU and would like to export it to C for efficiency reasons. As I am not a C programmer I am looking for a good way to do it and would appreciate some ideas how to do it. The problem is that this function uses a pre defined variable type and i currently only pass the index of an array to this function. I dont know if and how this could be done in C. Thanks!

    'this is the variabel type
    Public Type PositionGroupType
    ...
    End Type

    ' pgdata is an array of the type positiongrouptype
    public pgdata as positiongrouptype

    'this is the function that passes only the index (pginx) as input
    Public Function OnTick(byval pginx as long)

    With pgdata(pginx)
    ...
    End With

    End Function

  2. #2
    Frenzied Member moinkhan's Avatar
    Join Date
    Jun 2000
    Location
    Karachi, Pakistan
    Posts
    2,011

    Re: export VB function to C

    You want to translate it into C style coding? if yes then


    struct PositionGroupType{
    //blah blah blah
    };

    PositionGroupType pgdata[5];
    void main(void)
    {

    // any more blah blah
    }

    void OnTick(int index)
    {
    pgdate[index].??? //do whatever you want
    //offcourse some more blah blah...
    }


    And if this was not what you wanted.. i am sorry

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width