As Johnny said, you can do alot with PureBasic's structures.
The following example demonstrates assigning functions for working with Valentina Reports to elements in a PB structure:
Enumeration
#Valentina_Lib
EndEnumeration
Prototype Valentina_Project_Close(nProject)
Prototype Valentina_Project_New(filename$)
Prototype.i Valentina_Project_Open(nProject)
Prototype.i Valentina_Report_GetCount(nProject)
Prototype Valentina_Report_Init(macKey$,winKey$,linKey$)
Prototype.i Valentina_Report_Open(nProject,name$,datasource$,sql$)
Prototype Valentina_Report_PrintToDisk(nReport,filename$,nFormat,nFromPage,nToPage)
Prototype Valentina_Report_Shutdown()
Structure ValentinaReport
kToUnknown.i
kToMetafile.i
kToPostscript.i
kToPDF.i
kToHTML.i
kToLatex.i
kToSVG.i
kToPicture_GIF.i
kToPicture_JPG.i
kToPicture_PNG.i
kToPicture_TIFF.i
kToPicture_BMP.i
close.Valentina_Project_Close
count.Valentina_Report_GetCount
init.Valentina_Report_Init
new.Valentina_Project_New
openProject.Valentina_Project_Open
openReport.Valentina_Report_Open
printToDisk.Valentina_Report_PrintToDisk
shutdown.Valentina_Report_Shutdown
EndStructure
Procedure VP_Close(nProject)
CallFunction(#Valentina_Lib,"Project_Close",nProject)
EndProcedure
Procedure VP_New(filename$)
*bfr = UTF8(filename$)
nProject.i = CallFunction(#Valentina_Lib,"Project_New",*bfr)
FreeMemory(*bfr)
ProcedureReturn nProject
EndProcedure
Procedure VP_Open(nProject)
CallFunction(#Valentina_Lib,"Project_Open",nProject)
EndProcedure
Procedure.i VP_ReportCount()
ProcedureReturn CallFunction(#Valentina_Lib,"Project_GetReportCount",nProject)
EndProcedure
Procedure VR_Open(nProject,name$,datasource$,sql$)
*bName = UTF8(name$)
*bDatasource = UTF8(datasource$)
*bSql = UTF8(sql$)
nRes = CallFunction(#Valentina_Lib,"Project_MakeNewReportByNameWithDatasource",nProject,*bName,*bDatasource,*bSql)
FreeMemory(*bName)
FreeMemory(*bDatasource)
FreeMemory(*bSql)
ProcedureReturn nRes
EndProcedure
Procedure VP_Shutdown()
CallFunction(#Valentina_Lib,"Valentina_ShutdownReports")
EndProcedure
Procedure VR_Init(macKey$,winKey$,linKey$)
*bMkey = UTF8(macKey$)
*bWkey = UTF8(winKey$)
*bLkey = UTF8(linKey$)
CallFunction(#Valentina_Lib,"Valentina_InitReports",*bMkey,*bWkey,*bLkey)
FreeMemory(*bMkey)
FreeMemory(*bWkey)
FreeMemory(*bLkey)
EndProcedure
Procedure VR_PrintToDisk(nReport,filename$,nFormat,nFromPage,nToPage)
*bOut = UTF8(filename$)
CallFunction(#Valentina_Lib,"Report_PrintToDisk",nReport,*bOut,nFormat,nFromPage,nToPage)
FreeMemory(*bOut)
EndProcedure
Procedure.i ValentinaReports_New()
*v.ValentinaReport = AllocateStructure(ValentinaReport)
*v\kToUnknown = 0
*v\kToMetafile = 1
*v\kToPostscript = 2
*v\kToPDF = 3
*v\kToHTML = 4
*v\kToLatex = 5
*v\kToSVG = 6
*v\kToPicture_GIF = 100
*v\kToPicture_JPG = 101
*v\kToPicture_PNG = 102
*v\kToPicture_TIFF = 103
*v\kToPicture_BMP = 104
*v\close = @VP_Close()
*v\count = @VP_ReportCount()
*v\init = @VR_Init()
*v\new = @VP_New()
*v\openProject = @VP_Open()
*V\openReport = @VR_Open()
*v\printToDisk = @VR_PrintToDisk()
*v\shutdown = @VP_Shutdown()
ProcedureReturn *v
EndProcedure
CompilerIf #PB_Compiler_IsMainFile
libname$ = "libs/vcsdk_release_x64.dll"
CompilerIf #PB_Compiler_OS = #PB_OS_Linux
libname$ = "libs/libVCSDK.so"
CompilerElseIf #PB_Compiler_OS = #PB_OS_MacOS
;libname$ = ?
CompilerEndIf
If Not OpenLibrary(#Valentina_Lib,libname$)
Debug "Could not open library"
End
EndIf
*vr.ValentinaReport = ValentinaReports_New()
*vr\init("","","")
nProject = *vr\new("reports.vsp")
If nProject
*vr\openProject(nProject)
nReport = *vr\openReport(nProject,"Report_1","sqlite://reports_db.sqlite","select * from T1")
If nReport
*vr\printToDisk(nReport,"test.pdf",*vr\kToPDF,0,0)
Else
Debug "Failed to open report"
EndIf
Else
Debug "Failed to open project"
EndIf
*vr\close(nProject)
*vr\shutdown()
FreeStructure(*vr)
CloseLibrary(#Valentina_Lib)
CompilerEndIf