Function return the dll ??

Function return the dll ??

Postby Ale SB » Sat Apr 30, 2016 12:33 pm

Good Morning ;

How could I get the return of a function in the DLL harbour?

MyDll.dll
Code: Select all  Expand view

FUNCTION MSGPARAM()
  local cTitulo:="Msg Sem Parametros"
  MsgInfo(cTitulo)
 
return "Test Return"

********************************************************************************
#pragma BEGINDUMP
  #include <windows.h>
  #include <hbvm.h>
  #include <hbapi.h>
  #include <hbapiitm.h>
 
#define DllExport __declspec( dllexport )
  #define DllImport __declspec( dllimport )
 
  BOOL WINAPI DllMain( HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved )
  {
  HB_SYMBOL_UNUSED( hinstDLL );
  HB_SYMBOL_UNUSED( fdwReason );
  HB_SYMBOL_UNUSED( lpvReserved );
  switch( fdwReason )
  {
   case DLL_PROCESS_ATTACH:
    hb_vmInit( FALSE );
    break;
   case DLL_PROCESS_DETACH:
    hb_vmQuit();
    break;
  }
  return TRUE;
  }

  DllExport void __cdecl MSGPARAM()
  {
    hb_itemDoC( "MSGPARAM", 0 );
  }


  DllExport void __cdecl HBDLLENTRY( char * cProcName )
  {
    hb_itemDoC( cProcName, 0 );    
  }

#pragma ENDDUMP
 


MyPrg.prg
Code: Select all  Expand view

     hLib := hb_libLoad( "Mydll.dll" )      
     if !Empty( hLib )
          hb_DynCall( { "MSGPARAM", hLib, hb_bitOr( HB_DYN_CTYPE_CHAR_PTR , HB_DYN_CALLCONV_CDECL ) } )        
        hb_libFree( hLib )

//--//--//

     hLib := hb_libLoad( "Mydll.dll" )      
     if !Empty( hLib )
          hb_DynCall( { "HBDLLENTRY", hLib, hb_bitOr( HB_DYN_CTYPE_CHAR_PTR , HB_DYN_CALLCONV_CDECL )  },"MSGPARAM" )
        hb_libFree( hLib )
 


Regards, Ale SB
aleseribeli@hotmail.com

FwH, Hb Svn, ADS 8.1, ADS 10, Pelles C, FwPPC, MsVc 2008, MsVc 2010
"Conhecimento, você não subtrai quando divide; mas soma e multiplica."
**---Mário Persona---**
User avatar
Ale SB
 
Posts: 248
Joined: Wed Jan 11, 2006 11:30 am
Location: Campo Grande-MS / Brasil

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: No registered users and 73 guests