Thanks Sergey,
I just made a quick test and I'm pleased to say I can open a project, run a report and save it to a file
Enumeration
#Lib
EndEnumeration
Enumeration ValentinaReportPrintType
#kToUnknown
#kToMetafile
#kToPostscript
#kToPDF
#kToHTML
#kToLatex
#kToSVG
#kToPicture_GIF = 100
#kToPicture_JPG = 101
#kToPicture_PNG = 102
#kToPicture_TIFF = 103
#kToPicture_BMP = 104
EndEnumeration
Procedure Valentina_Init(mkey$,wkey$,lkey$,nReport=#False)
*bMkey = UTF8(mkey$)
*bWkey = UTF8(wkey$)
*bLkey = UTF8(lkey$)
If nReport
CallFunction(#Lib,"Valentina_InitReports",*bMkey,*bWkey,*bLkey)
Else
nCache = 10*1024*1024
CallFunction(#lib,"Valentina_Init",nCache,*bMkey,*bWkey,*bLkey)
EndIf
FreeMemory(*bMkey)
FreeMemory(*bWkey)
FreeMemory(*bLkey)
EndProcedure
Procedure Valentina_Shutdown(nReports=#True)
If nReports : CallFunction(#Lib,"Valentina_ShutdownReports") : EndIf
CallFunction(#Lib,"Valentina_Shutdown")
EndProcedure
Procedure.i Valentina_ProjectNew(filename$)
*bfr = UTF8(filename$)
nProject.i = CallFunction(#Lib,"Project_New",*bfr)
FreeMemory(*bfr)
ProcedureReturn nProject
EndProcedure
Procedure.i Valentina_ProjectOpen(nProject)
CallFunction(#Lib,"Project_Open",nProject)
EndProcedure
Procedure Valentina_ProjectClose(nProject)
CallFunction(#Lib,"Project_Close",nProject)
EndProcedure
Procedure.i Valentina_ReportCount(nProject)
ProcedureReturn CallFunction(#Lib,"Project_GetReportCount",nProject)
EndProcedure
Procedure.i Valentina_ReportOpen(nProject,name$,datasource$,sql$)
*bName = UTF8(name$)
*bDatasource = UTF8(datasource$)
*bSql = UTF8(sql$)
nRes = CallFunction(#Lib,"Project_MakeNewReportByNameWithDatasource",nProject,*bName,*bDatasource,*bSql)
FreeMemory(*bName)
FreeMemory(*bDatasource)
FreeMemory(*bSql)
ProcedureReturn nRes
EndProcedure
Procedure Valentina_ReportToDisk(nReport,out$,nFormat,nFromPage,nToPage)
*bOut = UTF8(out$)
CallFunction(#Lib,"Report_PrintToDisk",nReport,*bOut,nFormat,nFromPage,nToPage)
FreeMemory(*bOut)
EndProcedure
Procedure BailOut(msg.s,nProject)
Debug msg
If nProject > 0 : Valentina_ProjectClose(nProject) : EndIf
Valentina_Shutdown()
CloseLibrary(#Lib)
End
EndProcedure
If Not OpenLibrary(#Lib,"vcsdk_release_x64.dll")
Debug "Could not open library"
End
EndIf
Valentina_Init("","","")
Valentina_Init("","","",#True)
nProject.i = Valentina_ProjectNew("reports.vsp")
If nProject = 0 : BailOut("Could not open project",nProject) : EndIf
Valentina_ProjectOpen(nProject)
nReport = Valentina_ReportOpen(nProject,"Report_1","sqlite://reports_db.sqlite","select * from T1")
If nReport = 0 : BailOut("Could not open report",nProject) : EndIf
Valentina_ReportToDisk(nReport,"test.pdf",#kToPDF,0,0)
BailOut("All done :-)",nProject)
End