returning pointer to string between exe and dll

This is a discussion on returning pointer to string between exe and dll within the C Programming forums, part of the General Programming Boards category; I have written a program along with a 'plugin' type dll, but im confused on how exactly I go about ...

  1. #1
    Registered User
    Join Date
    May 2003
    Posts
    7

    returning pointer to string between exe and dll

    I have written a program along with a 'plugin' type dll, but im confused on how exactly I go about returning a string from a function inside of the dll. I understand that I need to use a pointer, but I don't know how to set this up in relation to scope between the dll and the main exe. If someone could shed some light on this or point me in the direction of a complete dll coding tutorial(c not c++) that includes info on pointers it would be much appreciated.

  2. #2
    Registered User
    Join Date
    Feb 2002
    Posts
    329
    In dll:
    Code:
    void someFunc(char *arg1){
      strcpy(arg1, "Test");
    }
    In Exe:
    Code:
    int main(void){
      char ptr[10];
      someFunc(ptr);
      printf(ptr);
    }

  3. #3
    Registered User
    Join Date
    May 2003
    Posts
    7
    ah, thank you very much

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how to monitor exe and dll interactions?
    By George2 in forum C Programming
    Replies: 1
    Last Post: 10-26-2007, 04:22 AM
  2. Converting exe to DLL
    By jamez05 in forum Windows Programming
    Replies: 0
    Last Post: 10-11-2005, 12:17 PM
  3. dll communicating between each other
    By cloudy in forum C++ Programming
    Replies: 5
    Last Post: 06-17-2005, 02:20 AM
  4. passing pointer to string from exe to dll
    By evilpope in forum C Programming
    Replies: 9
    Last Post: 05-24-2003, 08:30 AM
  5. Using MFC based DLL with C only exe
    By novacain in forum Windows Programming
    Replies: 4
    Last Post: 01-31-2002, 02:40 PM

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