I'll try again: C++ DLL return values for VB

This is a discussion on I'll try again: C++ DLL return values for VB within the C++ Programming forums, part of the General Programming Boards category; I thought I'd work off the thread I found, but Fordy locked the post whenever I tried to get some ...

  1. #1
    Registered User WebSnozz's Avatar
    Join Date
    Oct 2001
    Posts
    102

    I'll try again: C++ DLL return values for VB

    I thought I'd work off the thread I found, but Fordy locked the post whenever I tried to get some clarification on the resolution.
    It seemed logical to keep related info in the same post so that if someone searched the board for the info they'd find it in one place.
    Plus it was nice not having to start from square one. Oh well. Please add this odd rule, "Keep related info in completely seperate topics to create a mess" to the board rules so everyone is aware of it so they don't make the same mistake I did.


    I was interested in finding out what the best return type would be for a C++ dll function so that it is usable in VB. I would prefer something that easily converts from a STL string.

    The solution in the other post declared a
    Code:
    String *
    but it did not show what header was included for this and the cpitalized S confuses me as to what it is, or perhaps it's something only used in .NET?

    Thanks in advance for your replies. I would link to the other post for clarification since there was some good info there but I think that would anger the moderators and they would call it cross linking, or illegal cross referencing, or some other phrase that makes them feel really clever.
    WebSnozz-
    Cats have no butt cheeks.
    If one farted, then it would make a flute noise.

  2. #2
    &TH of undefined behavior Fordy's Avatar
    Join Date
    Aug 2001
    Posts
    5,789

    Re: I'll try again: C++ DLL return values for VB

    Originally posted by WebSnozz
    I thought I'd work off the thread I found, but Fordy locked the post whenever I tried to get some clarification on the resolution.
    It seemed logical to keep related info in the same post so that if someone searched the board for the info they'd find it in one place.
    Plus it was nice not having to start from square one. Oh well. Please add this odd rule, "Keep related info in completely seperate topics to create a mess" to the board rules so everyone is aware of it so they don't make the same mistake I did.
    I closed the thread because nobody had added to it since the start of October last year.......Nobody likes old (seemingly settled) threads being reserected.

  3. #3
    Registered User WebSnozz's Avatar
    Join Date
    Oct 2001
    Posts
    102
    What people hate more is when someone post a question that could have been found by searching the board. Which I did, but I did not understand the solution, so I could have just started from square one and getting flamed because there is already a solution, then having to explain to everyone I already looked at that, but wasn't clear on the solution.
    WebSnozz-
    Cats have no butt cheeks.
    If one farted, then it would make a flute noise.

  4. #4
    Programming Sex-God Polymorphic OOP's Avatar
    Join Date
    Nov 2002
    Posts
    1,078
    String there is just a typedef'd char (basing this off of the closed thread's context)

    IE

    typedef char String;

    Which is really just a silly thing to do...

  5. #5
    Registered User WebSnozz's Avatar
    Join Date
    Oct 2001
    Posts
    102
    Cool, thanks.
    WebSnozz-
    Cats have no butt cheeks.
    If one farted, then it would make a flute noise.

  6. #6
    Speedy5
    Guest
    I'm not sure what you have to do (I haven't read all of it yet) but lemme just tell you that .NET does NOT use char*. It uses unicode, __wchar_t, or wchar_t. That you can use with the .NET classes. To use a .NET string you use the prefix "S". So:

    String *s=S"hey";

    If you want to interface with them use the prefix "L" for unicode. If you want to use char* then you might want to check out:
    System.Text.Encoding.ASCII

    All this is for .NET. I dunno how helpful I was, but yea, hehehe

    For C++ to VB6, use BSTR, or a variant type.

  7. #7
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    The old solution is .NET only. "String" is a .NET Framework datatype that is not available in normal C++ or VB6. String passing between C++ and VB6 is quite a mess, but your best bet is to go with BSTR.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. is it ok like that?
    By ExDHaos in forum C++ Programming
    Replies: 8
    Last Post: 05-23-2009, 09:02 AM
  2. Another weird error
    By rwmarsh in forum Game Programming
    Replies: 4
    Last Post: 09-24-2006, 10:00 PM
  3. DirectInput help
    By Muphin in forum Game Programming
    Replies: 2
    Last Post: 09-10-2005, 11:52 AM
  4. Pong is completed!!!
    By Shamino in forum Game Programming
    Replies: 11
    Last Post: 05-26-2005, 10:50 AM
  5. Certain functions
    By Lurker in forum C++ Programming
    Replies: 3
    Last Post: 12-26-2003, 12:26 AM

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