calling a dll fortran with wxwindows

From: rom (mrom34_at_wanadoo.fr)
Date: 04/29/04


Date: 29 Apr 2004 02:38:56 -0700

Hi,

I use wxwindows for my application. I need to call a dll in fortran
but I have problem with stings.
My dll has a simple subroutine witch accept :
i (long)
r (real, 4 octets)
d (double précision)
str (string, 128 octets)

It returns a file 'dlltest.out' with the values of i,r,d and str.

I use this code im my program to load the dll:

wxDllType mydll=wxDllLoader::LoadLibrary("test.dll");
    
    typedef void (*inti)(long*,float*,double*,char *,int);
    inti pint;
    pint = (inti) wxDllLoader::GetSymbol(mydll,"DLLTEST");
    
    
     long a;
     a=12;
     float b;
     b=123;
     double c;
     c=1234;
     
      char st[13];
      strcpy(st,"Testing...");
   

       
     pint(&a,&b,&c,st,13);
     wxDllLoader::UnloadLibrary(mydll);}

It creates a file 'dlltest.out'. Its ok for a,b and c, but it write st
with many bad characters after "Testing...". I thinks its a problem of
lengh but I don't know how to solve it.

thanks



Relevant Pages

  • Re: Parameter of dlls function
    ... Both must be using the shared MFC DLL. ... void Foo(CString * str) ...
    (microsoft.public.vc.mfc)
  • MarshalAs(UnmanagedType. EXception
    ... I have DLL (unmannaged code), in this DLL I have some functions and ... one of those functions is GetDataBaseStructure, ... structure definition is as following: ...
    (microsoft.public.dotnet.languages.csharp)
  • Pass String from Vb.net application to VC++ dll in pocket PC 2003
    ... is that when i pass string parameter it's value is not passing to VC++ dll ... char* _stdcall getstring(char* str) ... Public Declare Function getstring Lib "mydll.dll" As ... When i debug my dll the value of string parameter is "". ...
    (microsoft.public.pocketpc.developer)