PureBasic DLL Usage

Blitz3D Forums/Blitz3D Programming/PureBasic DLL Usage

Seems like the MVCOM serial port library maybe messing with memory when closing a port. This seems to cause Blitz to lose it...

MRRaven - if your using PB - could you do a simple test that opens a port from Blitz using a PB dll via MVCOM, and another call to close the same port from Blitz. e.g.

PB Code: (compile as PBTest.dll)

ProcedureCDLL OpenPort(PortDef.s)
HCom.l = ComOpen(PortDef,0,1024,1024)
ProcedureReturn HCom
Endprocedure

ProcedureCDLL ClosePort(PortID.l)
ComClose (PortID)
ProcedureReturn 1
EndProcedure

Blitz Decls

.lib "PBTest.dll"

OpenPort%(PortID$)
ClosePort%(PortID%)


Blitz Code

PortID=OpenPort("COM2:4800,N,8,1")
Delay(1000)
ClosePort(HCom)


The 'ClosePort' command will always generate a memory access violation error for me.

Even if HCom is a Global in PB.