Results 1 to 4 of 4

Thread: Creating Dlls (w/ Borland 5.02)

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Sep 2000
    Posts
    28

    Arrow

    Hi,

    I've been trying to creating a simple (like adding two numbers or concatenating two strings) dll to use in VB.

    Of course, I try to do the most amount of stuff with the least amount of knowledge ;-) So _detailed_ step-by-step instructions would be nice.

    So far I've managed to...

    - create a project (in Borland 5.02 not VC)
    - make the target a .dll file
    - add a .cpp and .h file with one function
    - add a .def file with the text
    EXPORTS
    FunctionName

    Tried to make the dll got an error like ...unresolved reference from the root... or something like that.


    I bet I'm going about this all wrong so any advice/actual source code would be appreciated.

    Amanda

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    Could you post your code? I'll take a look at it for you.
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Sep 2000
    Posts
    28

    Unhappy

    Hi again,

    I read a couple of replies on this board and realized I was missing the crucial "__declspec(dllexport)" bit.

    When I added this to the function, I was able to create a dll that worked in VB.

    Yet when I compiled the dll I got a message that said "Failure" and in the message window (in Borland) it said

    "Info :Transferring to C:\PROGRAM FILES\BC5\BIN\implib.exe @c:\windows\TEMP\RSP0.$$$"

    I don't know enough to know what this means, and I find it strange that despite a "Failure" message, that the dll seems to work fine.

    Any insight would be appeciated,
    Amanda

    P.S. Here's my code

    vb_prac.cpp
    -----------
    extern "C" __declspec(dllexport) int _stdcall MyAdd(int a, int b)
    {
    return a + b;
    }

    vb_prac.def
    -----------
    EXPORTS
    MyAdd


  4. #4
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    I can't see why that would make a difference, since __declspec(dllexport) is designed as a replacement for the .def file.
    If you omit the .def file from your compilation, it should still work.

    (Since I don't have BC I can't give any help on the "Failure" message...)
    I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
    -- Linus Torvalds

Posting Permissions

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



Click Here to Expand Forum to Full Width