Solved

Create DLL using Turbo C ?

Posted on 1998-10-18
4
1,340 Views
Last Modified: 2008-02-26
How can I create DLL for my Visual Basic Application using turbo C?
0
Comment
Question by:anik
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 1

Expert Comment

by:mlaiosa
ID: 1253679
what version of turbo C, of VB
0
 

Author Comment

by:anik
ID: 1253680
turbo C++ 3.0, Visual Basic 6.0
0
 
LVL 1

Accepted Solution

by:
prozak earned 10 total points
ID: 1253681
I haven't actually done this with TC but I can tell you how to do it with MS VC++. All of you functions must be declared with the extern "C" qualifier if you're using C++ to prevent name mangling. Additionally all the functions that will be called by you VB program must be declared as stdcall (This affects how arguments are passed to function). And finally when compiling the DLL (this is under VC++ only as far as I know) I had to define a .def (module definition) file and specifically export each function in that, otherwise when I called the function from VB I would get an error "Could not find entry point" or something like that. Also when you declare the function in VB if it's ByVal then you just get the value (i.e. ByVal myVar As Long would be long myvar in C and ByRef myVar as Long would be long *myvar in C. After reading this last sentence, I guess you could've figured that one out by yourself :) Strings must be passed as ByVal so VB can do the translation from a multi-byte string (16-bit characters) to a byte string (8-bit ASCII characters). The only way I've found to get access to the multi-byte versions of VB strings is if the value is passed as type Variant. If you try to pass the string as ByRef, you get a pointer to a pointer to the string but VB still packs all the characters to 8-bits. All of this info is for VB5. I haven't used VB6 yet but I've heard that in this respect it is the same.
Hope this helps!
0
 

Expert Comment

by:peterpan1975
ID: 1253682
there (at VStudio vb cd) is a file vb5dll.doc:
\vb5.0\tools\docs
very good explanation how to connect VC 4.0 dll's to vb... Im not sure if it applies to TC, but I hope it might be helpful as well :)
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Read file descriptor 3 in C 14 123
Parsing XML instructions in Java/any other language.... 3 121
Acrinis True image 2 111
If a cell in a range equals "YES" return specific Test. 4 43
Summary: This tutorial covers some basics of pointer, pointer arithmetic and function pointer. What is a pointer: A pointer is a variable which holds an address. This address might be address of another variable/address of devices/address of fu…
This is a short and sweet, but (hopefully) to the point article. There seems to be some fundamental misunderstanding about the function prototype for the "main" function in C and C++, more specifically what type this function should return. I see so…
Video by: Grant
The goal of this video is to provide viewers with basic examples to understand and use for-loops in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to create, access, and change arrays in the C programming language.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question