SPONSORS:






User Tag List

Results 1 to 6 of 6
  1. #1
    Junior Member
    Join Date
    Jul 2001
    Location
    Beaverton, Oregon, USA
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Handling pointers in the API function calls, DLL

    Help,

    I am trying to add DLL calls in my test script.
    I understand using DLL declaration with function calls in Window APIs. (the
    Help index or user's manual).
    DLL "NameOfDll.dll"
    {
    prototype();
    Functions in DLL;
    Functions in DLL;
    }

    However, the APIs in the application written in C or C++ has pointers and
    Handles.
    How I could take care of the pointers and Handles in the above case.
    Especially the real-time application APIs use heavily pointers and Handles.
    If I need to create some other shells for the purpose, what should I do?

    <Example API call ??>
    Dll "PortalAPI.dll"
    {
    PORTAL_STATUS Fxn(PortalMessage_t* pPortalMsg)
    {
    if (pPortalMsg->PortalMsg.displayControl == PORTAL_MSG)
    printf("Received message: %s", pPortalMsg->PortalMsg.buf);
    }
    }

    I guess I need to add a string datatype PORTAL_STATUS , so on... (?), but
    how I could handle the pointers?

    - If anyone knows the answer or tips, please let us know.

    Thanks a lot,

    /John Yoo



    ------------------

  2. #2
    Senior Member
    Join Date
    Mar 2000
    Location
    Dublin, Ireland
    Posts
    152
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Handling pointers in the API function calls, DLL

    Hi,

    Which tool are you using?

    John.
    John O'Neill.
    Quality Automation Ltd.
    www.quality-automation.com

  3. #3
    Junior Member
    Join Date
    Jul 2001
    Location
    Beaverton, Oregon, USA
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Handling pointers in the API function calls, DLL

    WOOP! I didn't say about the automation tool that I used. The automation tool is SilkTest v 5.03 and the function calls (DLLs) is in C. I'm looking into how Java handles the C function library using pointers. It isn't clear to me yet. If you know how JAVA handles the C function calls using pointers, please let us know. It might give me a clue to go further into a resolution.

    /John Yoo


    ------------------

  4. #4
    Senior Member
    Join Date
    Dec 2000
    Location
    Portland, OR
    Posts
    403
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Handling pointers in the API function calls, DLL

    I haven't done Java in over 2 years now (and I only did it for a few months) so any comments I give are probably wrong!

    LOL

    But seriously, doesn't Java have a way to send in refences to an object? After all, that is all a pointer really is , a reference to an object. In C's case, the reference happens to be an actual memory location.

    As I recall, (And this was Java 1.1) Java does not allow for pointer creation, but a lot of the more complex data structures (like arrays and objects I think) actually are references anyways. Sending in the reference to the C call might just do the trick....

    But I bet that you already tried this right?

    ------------------
    It Depends.

  5. #5
    Junior Member
    Join Date
    Jul 2001
    Location
    Beaverton, Oregon, USA
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Handling pointers in the API function calls, DLL

    I know the @ Reference operator in the SilkTest does do some trick. I red one reply from Canada saying that the SikTest supports [char*] pointer but I don't know how I connect to @ reference operator together or its conversion. Actually, the * symbol (pointer) in SilkTest shows a compile error.
    If anyone knows whether there is an example to handle this issue, please let us know.

    Thank you for your comments.

    /John Yoo

    ------------------

  6. #6
    Senior Member
    Join Date
    Jan 2001
    Posts
    750
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Handling pointers in the API function calls, DLL

    If you can't change the dll don't bother with anything because you need to write wrapper functions to convert types that silk can't handle - in this case pointers.

    As alanark pointed out above(so clearly , a pointer is a reference to an address which in turn is a 'unsigned int'. Basically you need wrapper function that returns the reference(unsigned int) from a pointer and use it as if it is a pointer.

    As for handles, just use 'int' type, because they are just numbers, except some exceptions. The tricky part is to get a clean and easy way to work with complicated data structure using such a way.

    ------------------

 

 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

vBulletin Optimisation provided by vB Optimise v2.6.0 Beta 4 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
User Alert System provided by Advanced User Tagging v3.0.9 (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Questions / Answers Form provided by vBAnswers (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
vBNominatevBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Feedback Buttons provided by Advanced Post Thanks / Like (Pro) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
Username Changing provided by Username Change (Free) - vBulletin Mods & Addons Copyright © 2016 DragonByte Technologies Ltd.
BetaSoft Inc.
Digital Point modules: Sphinx-based search
All times are GMT -8. The time now is 10:59 PM.

Copyright BetaSoft Inc.