Results 1 to 3 of 3

Thread: C++ DLL Problem

  1. #1

    Thread Starter
    Lively Member trip85's Avatar
    Join Date
    Jun 2000
    Location
    Chalfont, PA
    Posts
    106
    Hello Everyone-

    I am having a problem with C++ DLL that I am calling from my VB program.

    When I call the DLL I have to pass in a string and an integer. When I debug the program in C++ the string that is passed in is fine, but the integer that I am passing in gets screwed up. I am passing in "1" as the integer when I call the DLL in VB. When I am debugging in C++ the variable that the integer gets assigned to equals "1240848"

    Is there some kind of conversion that must be done between C++ and VB so that integers can be passed back and forth?

    I would greatly appreciate any help with this, if more info is needed please let me know.
    Thanks in Advance!
    TRIP85

    In the game of life, it's not whether you win or lose, it's how drunk you get.
    -Homer Simpson

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    If the C++ argument is int, it must be Long for VB.

    This is because in C (and therefore C++), an int is the size of the system word, which on 32-bit systems is 4 bytes, equivalent to long. In VB the Integer type is still only 2 bytes, so you must use Long.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    Lively Member trip85's Avatar
    Join Date
    Jun 2000
    Location
    Chalfont, PA
    Posts
    106
    Thanks guys, I'll do that and see if it solves my problem.
    Thanks in Advance!
    TRIP85

    In the game of life, it's not whether you win or lose, it's how drunk you get.
    -Homer Simpson

Posting Permissions

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



Click Here to Expand Forum to Full Width