This uses specific string variables but this can be modified for other types:
put this call under Option Explicit:
Private Declare Function Compile Lib "YourDLLName.dll" (ByVal FilePath1 As String, ByVal FilePath2 As String, ByVal CodeValue As String) As Long
Function called in C++ DLL:
This function should be declared in your exports (.def) also
bool _stdcall Compile(LPCTSTR filepath, LPCTSTR filepath, LPCTSTR codevalue)
The function is then called by an event in VB program, button click or whatever
Compile(App.Path + "\" + txt1.Text + ".txt", App.Path + "\" + txt2.Text + ".txt", txtCode.Text)
And of course the C++ DLL would be in your computer's system folder.