Solved

Create DLL using Turbo C ?

Posted on 1998-10-18
4
1,325 Views
Last Modified: 2008-02-26
How can I create DLL for my Visual Basic Application using turbo C?
0
Comment
Question by:anik
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

Are your AD admin tools letting you down?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

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

An Outlet in Cocoa is a persistent reference to a GUI control; it connects a property (a variable) to a control.  For example, it is common to create an Outlet for the text field GUI control and change the text that appears in this field via that Ou…
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…
The goal of this video is to provide viewers with basic examples to understand recursion in the C programming language.
The goal of this video is to provide viewers with basic examples to understand how to use strings and some functions related to them in the C programming language.

777 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