another simple question

This is a discussion on another simple question within the C++ Programming forums, part of the General Programming Boards category; hi there,thanks for everyone,i have another question... i have a function in a dll( i wrote the dll using c++),and ...

  1. #1
    totymido
    Guest

    Question another simple question

    hi there,thanks for everyone,i have another question...
    i have a function in a dll( i wrote the dll using c++),and i need to call this function from VB program..
    the function in the dll is:

    char pppp[]="abcd";
    _declspec (dllexport) char *buff()

    {

    return pppp;
    }

    i used this in the vb module:
    Declare Function buff Lib "d:\dddd.dll" Alias "?buff@@YAPADXZ" () As long

    and this in the project:

    Private Sub Command3_Click()
    k = buff
    Print "k=" &k

    but i got the folowing strange result
    k=43657896

    what is wrong

  2. #2
    pronounced 'fib' FillYourBrain's Avatar
    Join Date
    Aug 2002
    Posts
    2,297
    not sure if this is in the right forum and I don't really know VB but I think that VB requires PASCAL calling convention. This means that you should use __stdcall or __cdecl
    "You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter

  3. #3
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,584
    Yes I believe you are correct. All BASICs use the PASCAL calling convention - MS seems obsessed with PASCAL calling convention - I'm sure there is good reason for it but still.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple question regarding variables
    By Flakster in forum C++ Programming
    Replies: 10
    Last Post: 05-18-2005, 08:10 PM
  2. Simple class question
    By 99atlantic in forum C++ Programming
    Replies: 6
    Last Post: 04-20-2005, 11:41 PM
  3. Simple question about pausing program
    By Noid in forum C Programming
    Replies: 14
    Last Post: 04-02-2005, 08:46 AM
  4. simple question.
    By InvariantLoop in forum Windows Programming
    Replies: 4
    Last Post: 01-31-2005, 11:15 AM
  5. simple fgets question
    By theweirdo in forum C Programming
    Replies: 7
    Last Post: 01-27-2002, 05:58 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21