Passing a type to a dll

BlitzMax Forums/BlitzMax Programming/Passing a type to a dll

TartanTangerine (was Indiepath)(Posted 2005) [#1]
Has anyone succeeded in getting Type data passed to a dll.

I am having issues getting the pointer to the type and passing that to the function.

I get errors like : - Unable to convert from "iNet" to Long Ptr.

Module Info:
Extern "WIN32"
 	Function tnetscore:Int(g:Long Ptr)
EndExtern

Type Structure
Type iNet
	Field Server:String
  	Field Script:String
  	Field Extip:String
	Field Port:String
	Field GameName:String
	Field GameServer:String
End Type



Dreamora(Posted 2005) [#2]
Did you try Byte Ptr?
They are normally used to "export" data from BM to C / C++ functions


TartanTangerine (was Indiepath)(Posted 2005) [#3]
Yeah that stopped the errors but all that is being sent is a load of trash.

Every single Field contains the same trash :-
€µH



Difference(Posted 2005) [#4]
Should your Fields maybe be String Ptr's ?


Perturbatio(Posted 2005) [#5]
try $z instead of :String


TartanTangerine (was Indiepath)(Posted 2005) [#6]
that did not work either, infact the fields are now empty.


Perturbatio(Posted 2005) [#7]
well it's a step up from
€µH

:)

$z is a c-style string so I would imagine you *have* to do that (either that or use Byte Ptr).

Local f:Byte Ptr
f = "test"
Print "".fromCString(f)



Chris C(Posted 2005) [#8]
from memory each max type has a small header
try passing a byte ptr to the first field...