Using Visual Studio.net, is it possible to compile code in from another language?
We're developing a VB.Net app, and have come across some C code which would aid us immensely, but dont know if its possible to compile it in along with the VB?
Not really, but I'm sure that you'll find stuff out there.
You have to have a minimum of C knowledge to do it.
You need a C compiler (could be visual studio).
1) define your export procedures/functions as '_stdcall'
2) Add an export library (.def) to you project, where you define the dll entry points (the procs/funcs) that you want to export.
Compile that into a dll and you can call is as any other com dll:
TestCdll.vb
-----------------------------------------------
Private Declare Function MyMul1 Lib "test.dll" (ByVal A As Double, ByVal B As Double) As Double
...
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
MessageBox.Show(MyMul1(2, 2, 2).ToString)
End Sub
-----------------------------------------------
Good luck
Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.