CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2004
    Posts
    61

    VC++ DLL and VB call VC++ DLL

    Hi,

    I am using win xp service pack2, vb and vc version 6.0. MS studio service pack 5.

    I have the following scenario:

    vc1.dll call vc2.dll functions, then vc1.dll functions is called by vb program.
    My vb program when compiled as a exe file works fine, but ran from vb IDE doesn't work fine. I notice vb program when ran from my pc vb IDE can call vc1.dll as the vc1 dll declaration is declare in vb program, however vc2.dll is not called at all from vc1.dll ! The strangest thing, my program runs fine on other pcs, both from running from vb IDE, and as vb.exe file.

    I would like to get the basics correct,
    I only included the vc2 library files insides my vc1 workspace, and declare an object of vc2 to access vc2 whatever functions. I ran my vb program from vc++ IDE, it works fine. Do I need to specifically declare a block of statements ie _declspec(dllimport) my vc2 dll into my vc1???

    I looked at series of articles at http://www.codeproject.com/dll/XDllPt1.asp but I am still not very clear on this.

    Could anyone please advise me?
    I tried all kinds of ways, putting the vc++ dlls in the same directory as vb program, or in the system directory or specifically include my directory path in the PATH env, reinstalling Microsoft visual studio. All attempts fail.

    Thanks, Sally
    Last edited by sallypeh; June 23rd, 2005 at 08:39 PM.

  2. #2
    Join Date
    Mar 2005
    Location
    On the Dark Side of Moon
    Posts
    86

    Re: VC++ DLL and VB call VC++ DLL

    sallypeh,

    well one thing i can add dont use _declspec(dllimport) Please use __stdcall <fn Name > and export this function from .def file like exports
    fnname @1 etc ...some times _declspec gives problmes ...of course this is what my Experience is

    Good Luck,

    x8086
    Last edited by x8086; June 23rd, 2005 at 10:02 PM. Reason: correted

    Problem Is An Opportunity To Do Your Best.

    All Code Guru Member's
    Poll : -Please Vote For Code Guru Forum Programming competition


  3. #3
    Join Date
    Sep 2004
    Posts
    61

    Re: VC++ DLL and VB call VC++ DLL

    Quote Originally Posted by x8086
    sallypeh,

    well one thing i can add dont use _declspec(dllimport) Please use __stdcall <fn Name > and export this function from .def file like exports
    fnname @1 etc ...some times _declspec gives problmes ...of course this is what my Experience is

    Good Luck,

    x8086
    For .def, that's for vb to use the DLL functions.
    What should I declare in my vc1.dll or vc2.dll coding so my vc1.dll use vc2.dll functions ?

    Thanks, Sally

  4. #4
    Join Date
    Jun 2005
    Posts
    50

    Red face Re: VC++ DLL and VB call VC++ DLL

    Declare the im[ported functions in the .def file.
    use proper __stdcall(...) decalaring statement of the function to be imported.
    &
    one easy thing u can do that , use WM_USER message from vc1 dll to vc2 dll to check whether message passing is right or wrong.

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

Featured