×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

calling a c dll function

calling a c dll function

calling a c dll function

(OP)
hello,
i want to use a function from a dll program. Here is my code:

CODE --> Fortran

character :: infile,outfile

interface 
   subroutine dllFunction(infile, outfile) bind(C, name="main")
      use iso_c_binding, only: C_CHAR, C_NULL_CHAR
      character(1,c_char) :: infile
      character(1,c_char) :: outfile
   end subroutine dllFunction
end interface

call dllFunction(infile, outfile) 

The problem that the program call iteratively the dllfunction and it should be call it only once.
The dll is writen in C. Here is the C function that it should be used.

CODE --> c

#ifdef DLLCONFIG
#define DLL_API __declspec(dllexports)
#else
#define DLL_API
#endif

DLL_API int main(char *infile, char *outfile) {

} 
Any idea because call the function all the time?
Thanks

RE: calling a c dll function

Is this your first attempt at using C with Fortran? If it is, try using ints first, then an int array and then char and then char array. Char arrays are stored very differently in C and Fortran.

Also don't call your routine main - the function called main has a special meaning in C>

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close