Results 1 to 2 of 2

Thread: Making My Own DLLs Using C++

  1. #1

    Thread Starter
    Lively Member iataman's Avatar
    Join Date
    Jun 2000
    Location
    Turkey
    Posts
    71

    Question

    Hello World,

    Is it possible for anyone to make his own function library
    using Turbo C++ and make it available for VB projects?

    In fact, i have a serial port communication program which
    i wrote in Turbo C++. Thank God it is working, and i want
    to use some of its funcs in VB. How can I, if possible?

    Thank in advance.

    While YourAge<=40
    Live(YourLife)
    Wend

  2. #2
    Monday Morning Lunatic parksie's Avatar
    Join Date
    Mar 2000
    Location
    Mashin' on the motorway
    Posts
    8,169
    To make a DLL, there are linker options for it. However, you need to tell it what to export. Firstly, the function must use the stdcall calling convention (check your manual - try __stdcall or stdcall), and there must be a .def file. For example:

    testdll.cpp
    Code:
    long __stdcall exportfunc(long x) {
        return x * x;
    }
    testdll.def
    Code:
    LIBRARY "TESTDLL.DLL"
    
    EXPORTS
        exportfunc
    Then, to use in VB, just make a declare for it.
    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