Using a C/C++ static library from VB 
Author Message
 Using a C/C++ static library from VB

If I have been given a C/C++ .h file; what do
I have to do to reference it (static library not
DLL) from within VB (v 4.0); ie what compilation
and/or declarations/referencing is required
to use this as a static library from with Visual
Basic.

Thankyou in advance for all responses...
If possible please email me a copy of the
response (wouldn't want to miss it).

Thanks



Mon, 30 Oct 2000 03:00:00 GMT  
 Using a C/C++ static library from VB

Static libraries in C are precompiled code blocks, written in C. When you
compile a program in C, the code referenced in the libraries is copied into
the exe. You cannot do the same thing in VB; that would mean mixing C and VB
code in one exe. In order to use C / c++ code it must be in the form of a
dll of some kind. Then, use the C header file as a template to write the
equivalent function, type and const declarations in VB.
Niels,

Quote:

>If I have been given a C/C++ .h file; what do
>I have to do to reference it (static library not
>DLL) from within VB (v 4.0); ie what compilation
>and/or declarations/referencing is required
>to use this as a static library from with Visual
>Basic.

>Thankyou in advance for all responses...
>If possible please email me a copy of the
>response (wouldn't want to miss it).

>Thanks



Tue, 31 Oct 2000 03:00:00 GMT  
 Using a C/C++ static library from VB

Quote:

>If I have been given a C/C++ .h file; what do
>I have to do to reference it (static library not
>DLL) from within VB (v 4.0); ie what compilation
>and/or declarations/referencing is required
>to use this as a static library from with Visual
>Basic.

>Thankyou in advance for all responses...
>If possible please email me a copy of the
>response (wouldn't want to miss it).

>Thanks

Including a static library in a project means including an implied library
binary file. This will instantiate the DLL whenever any function within that
DLL is called in the project. VB 4.0 or 5.0 just cannot do that. There is no
provision for including implied libraries within a project. It is because VB
only accepts Pascal-type conventions in its arguments. C/C++ code accepts
C-type parameters and pascal-type parameters.

The best that you can do is to do an explicit declarations of the functions
within your project.



Fri, 03 Nov 2000 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Link with static C/C++ libraries?

2. Calling functions in C++ static library

3. Using static libraries with VB

4. link to static library using vb (*.lib file)

5. Using a static library in VB??

6. good VB website(s) for high school CS teacher??

7. Using a C++ Library in VB

8. Using a C++ Library in VB

9. Using a C++ Library in VB

10. Another CS-Realizer question

11. CS-RCS with VB6

12. ANNOUNCE: CS-RCS Version 1.2

 

 
Powered by phpBB® Forum Software