Results 1 to 3 of 3

Thread: Vb.exe->C'dll->fortran.dll Need help

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 1999
    Location
    CapeTown,South-Africa
    Posts
    22
    HI all,

    I have a VB.exe what calls a c dll that calls a fortran dll.

    It calculate 100% the values, but gives 49 -Bad DLL calling convention.

    Any idea's

    Thanks

    Christo

  2. #2
    Fanatic Member Jerry Grant's Avatar
    Join Date
    Jul 2000
    Location
    Dorset, UK
    Posts
    810

    Cool

    I am assuming that you have declared the API call correctly, so I won't try to explain that.

    The problem is likely to be in the C++ dll export.

    If you have a .H file for the C++ dll then check the following:

    if the function youare calling is declared as: '__declspec(dllexport) FunctionName' then you will get this error at runtime in the VB IDE, and not after the application is compiled!

    To overcome, in the C++ dll, modify the function declaration to: '_stdcall FunctionName'

    This problem is because the VB compiler sorts out the datatpe conversion correctly, although the IDE cannot, a _stdcall function is what we in the VB world expect a dll to be using.

    Hope this answers your problem!

    Jerry Grant................tnarG yrreJ
    Website: <JG-Design></.net>
    Email: [email protected]
    Working towards a bug free world......
    (Not a Microsoft employee)

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 1999
    Location
    CapeTown,South-Africa
    Posts
    22
    HI all,

    The probleem seems to be the version of c I have being using
    VB version 6, C version 5, Fortran version 6.
    If i recompile my c code in version 6 it does not give the
    error anymore, but values are now incorrect ,will keep you informed.

    Thanks.

    Christo

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