• Advertisement

biggurlz

Member
  • Content count

    4
  • Joined

  • Last visited

Community Reputation

122 Neutral

About biggurlz

  • Rank
    Newbie
  1. Using GetProcAddress in C

    [quote]Original post by LessBread To use a string as an out parameter, you'll need to make the parameter type a pointer to pointer. [quote] i've done that,but i still got error.here's the error i got: "the value of ESP was not properly saved accross a function call.this is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention." help me.tq
  2. Using GetProcAddress in C

    ----------CODE.DLL------------- extern "C" { BOOL Generate_Code(char* input, char* output); } -------------------------------------- here's first attempt i do it : -----------APPLICATION.EXE------------- typedef BOOL(__stdcall *MYPROC)(LPTSTR); MYPROC ProcAdd; BOOL fFreeResult, fRunTimeLinkSuccess = FALSE; int main(char *IN,char *OUT) { // Get a handle to the DLL module. HMODULE hdll = LoadLibrary ("CODE.DLL"); // If the handle is valid, try to get the function address. if hdll!= NULL) { ProcAdd = (MYPROC) GetProcAddress (hdll,"Generate_Code"); // If the function address is valid, call the function. if (NULL != ProcAdd) { fRunTimeLinkSuccess = TRUE; (ProcAdd) (IN); //input data sent to dll } // Free the DLL module. fFreeResult = FreeLibrary(hdll); } // If unable to call the DLL function, use an alternative. if (! fRunTimeLinkSuccess) printf("Message via alternative method\n"); return 0; } ------------------------------------------------------------------------------- input is value that i supply and out is output i get from library the question is...how to get value out? so,here's my second attempt : ------------APPLICATION.EXE------------- typedef BOOL(__stdcall *MYPROC)(char * in, char * out); MYPROC ProcAdd; BOOL fFreeResult, fRunTimeLinkSuccess = FALSE; int main(char *IN,char *OUT) { // Get a handle to the DLL module. HMODULE hdll = LoadLibrary ("CODE.DLL"); // If the handle is valid, try to get the function address. if hdll!= NULL) { ProcAdd = (MYPROC) GetProcAddress (hdll,"Generate_Code"); // If the function address is valid, call the function. if (NULL != ProcAdd) { fRunTimeLinkSuccess = TRUE; (ProcAdd) (IN,OUT); //in is input that i supply and out is output i get from library } // Free the DLL module. fFreeResult = FreeLibrary(hdll); } // If unable to call the DLL function, use an alternative. if (! fRunTimeLinkSuccess) printf("Message via alternative method\n"); return 0; } ------------------------------------------------------------------------------ but the program got error.when i debug it stop at --> (ProcAdd) (IN,OUT); right after -->fRunTimeLinkSuccess = TRUE; how to solve this problem? please help me..
  3. Using GetProcAddress in C

    Quote:Original post by Specchum Quote:Original post by biggurlz i've a situation where i want to call a dll(i create this dll) and this function return 2 string values.how to get those return value for me to use it im my exe?? Erm...how does your function manage to return 2 string values when a function can return only one value. mayb i misunderstood with all the article i've read.sorry guys.since i'm new with this loadlibrary things. i've change some codes in mydll to return only one string.but then,how am i gonna get the return value? how should i code it?tq so much.
  4. Using GetProcAddress in C

    i've a situation where i want to call a dll(i create this dll) and this function return 2 string values.how to get those return value for me to use it im my exe?? here's some of my codes: //declaration typedef int (*MYPROC)(LPTSTR); HINSTANCE hinstLib; MYPROC ProcAdd; BOOL fFreeResult, fRunTimeLinkSuccess = FALSE; char libname[100]; char funcname[100]; char tmpbuf[1000]; // Get a handle to the DLL module. hinstLib = LoadLibrary(libname); // If the handle is valid, try to get the function address. if (hinstLib != NULL) { ProcAdd = (MYPROC) GetProcAddress(hinstLib, funcname); // If the function address is valid, call the function. if (NULL != ProcAdd) { fRunTimeLinkSuccess = TRUE; (ProcAdd) (tmpbuf); //here's i send the input value// //but where should i get the return value??// } // Free the DLL module. fFreeResult = FreeLibrary(hinstLib); } // If unable to call the DLL function, use an alternative. if (! fRunTimeLinkSuccess) printf("Message via alternative method\n");
  • Advertisement