building a DLL

This is a discussion on building a DLL within the C++ Programming forums, part of the General Programming Boards category; I am writing in C++ a DLL for a program, that is probably written in Fortran. This DLL includes a ...

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    1

    building a DLL

    I am writing in C++ a DLL for a program, that is probably written in Fortran. This DLL includes a function, that has several arguments, and some of them are then returned as results. Problem is, that some arguments are one- or two-dimensional array of float or double and I don't know, how to declare function header properly.
    For non-dimensional variables, this is easy: I just add the & sign (like int &PrjLen) and the value of the PrjLen variable is returned properly to the main program. But for one- and two-dimensional arrays, this does not work. I tried several combinations (like double &Matrix1[6][6], double &Matrix2[][6], double Matrix3[6][6], double Matrix4[][6], ...), yet none of them worked.
    Please help me?

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    here is how I declare it in header file for a function that can be called by c or c++. I suspect it could be used by fortran too, but don't know for sure.
    Code:
    extern "C" __declspec(dllimport) double __cdecl foo(double matrix[][6]);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to solve warnings that appear when building my DLL...
    By starcatcher in forum Windows Programming
    Replies: 6
    Last Post: 12-14-2008, 10:47 AM
  2. non-MFC DLL with MFC app question.
    By Kempelen in forum Windows Programming
    Replies: 10
    Last Post: 08-20-2008, 07:11 AM
  3. dll communicating between each other
    By cloudy in forum C++ Programming
    Replies: 5
    Last Post: 06-17-2005, 02:20 AM
  4. DLL and std::string woes!
    By Magos in forum C++ Programming
    Replies: 7
    Last Post: 09-08-2004, 12:34 PM
  5. .lib vs .h vs .dll
    By Shadow12345 in forum C++ Programming
    Replies: 13
    Last Post: 01-01-2003, 04:29 AM

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