diff --git a/Makefile.in b/Makefile.in index 52e5c93..d85a138 100644 --- a/Makefile.in +++ b/Makefile.in @@ -26,6 +26,7 @@ GLUELIB=lib3270-mono@DLLEXT@ LIBNAME=pw3270-sharp.dll +TESTPROGRAM?=vbtest #---[ Configuration values ]------------------------------------------------------------- @@ -223,9 +224,9 @@ Debug: \ run: \ $(BINDBG)/$(GLUELIB) \ $(BINDBG)/$(LIBNAME) \ - $(BINDBG)/sample.exe + $(BINDBG)/$(TESTPROGRAM).exe - @$(MONO) $(BINDBG)/sample.exe + @$(MONO) $(BINDBG)/$(TESTPROGRAM).exe $(BINDBG)/$(GLUELIB): \ src/native/*.cc \ diff --git a/src/native/private.h b/src/native/private.h index 4c37e3c..fa631f0 100644 --- a/src/native/private.h +++ b/src/native/private.h @@ -54,6 +54,14 @@ #endif + #include + + #ifdef DEBUG + #define debug( fmt, ... ) fprintf(stderr, "%s(%d) " fmt "\n" , __FILE__, (int) __LINE__, __VA_ARGS__ ); fflush(stderr); + #else + #define debug( fmt, ... ) /* */ + #endif // DEBUG + #include #include #include diff --git a/testprograms/vbtest.vb b/testprograms/vbtest.vb index 8aadeb2..d96459a 100644 --- a/testprograms/vbtest.vb +++ b/testprograms/vbtest.vb @@ -7,29 +7,43 @@ Imports System.Runtime.InteropServices Public Module modmain - _ + _ Private Shared Function tn3270_create_session(ByVal Name As String) As IntPtr End Function - _ + _ Private Shared Function tn3270_destroy_session(ByVal hSession As IntPtr) as Long End Function - _ - Private Shared Function tn3270_get_version(ByVal hSession As IntPtr, ByRef buffer As StringBuilder, ByVal strlen as Integer) as Long + _ + Private Shared Function tn3270_get_version(ByVal hSession As IntPtr, ByVal buffer As StringBuilder, ByVal strlen as Integer) as Long End Function - ' Main is the application's entry point. + _ + Private Shared Function tn3270_get_revision(ByVal hSession As IntPtr, ByVal buffer As StringBuilder, ByVal strlen as Integer) as Long + End Function + + ' Application's entry point. Sub Main() dim host as IntPtr = tn3270_create_session("") + dim buffer As New StringBuilder(1024) + + ' Get library version + tn3270_get_version(host, buffer, 1024) + dim vrs as String = buffer.toString + + ' Get Library revision + tn3270_get_revision(host, buffer, 1024) + dim rev as String = buffer.toString ' Write text to the console. - Console.WriteLine ("Hello World using Visual Basic!") + Console.WriteLine ("Using pw3270 version " + vrs + " revision " + rev) + + tn3270_destroy_session(host) End Sub End Module - -- libgit2 0.21.2