Creating dlls Aka the search for the grail

BlitzMax Forums/BlitzMax Programming/Creating dlls Aka the search for the grail

AntonyWells(Posted 2006) [#1]
Where do we stand on creating dlls? I remember two attempts that had varying success but it's such a long time ago now I doubt they still apply to bmax.

Any links to them would still be great just in case though.


Damien Sturdy(Posted 2006) [#2]
I believe we aren't allowed to do it with Max.


Robert Cummings(Posted 2006) [#3]
You are allowed to do it but you will require a special license to do so.


JoshK(Posted 2006) [#4]
You need a special license from BRL to distribute a dll. I'm sure they would be reasonable, so I wouldn't let that stop you.


AntonyWells(Posted 2006) [#5]
I basically just want to wrap aurora and net optica into a dll so I can release C++/C# versions with a oop interface.

I'd be happy to work out a license with brl so I don't see that as an issue. Did you ever manage it halo? I remember your post on the subject.


kfprimm(Posted 2006) [#6]
http://www.blitzbasic.com/Community/posts.php?topic=50045


N(Posted 2006) [#7]
http://blitzbasic.com/Community/posts.php?topic=53607


AntonyWells(Posted 2006) [#8]
OK, I've got a dll compiling ok, but it appears if you do anything with blitzstrings in the dll it crashes without an error.

Literally anything, like a simple c string to blitz string convertor.

Function cToStr:String( c:Byte Ptr )

	Local ret:String
	Local j=0
	Repeat
		Local a = c[j]
		If a =0
			Exit
		EndIf
		ret:+Chr( a )
		j:+1
	Forever
	Return ret
	
End Function

Function AC_CreateEntity:TEntity( name:Byte Ptr )"win32" 'EXPORT

	Local ent:TEntity = TEntity.CreateMesh( cToStr(name) )
	Return ent

End Function


The other functions work, it creates the aurora window fine, but as soon as it hits the CreateEntity function it bombs out. Anyone else experienced this? Know a work around? Do I have to initialize soem aspect of blitz before hand?
As it's looking like the C++ version of Aurora will just have to link directly to OgreMax.dll wrote in c++ and forego the extras wrote in blitz like blitz net optica.


N(Posted 2006) [#9]
Unrelated to the DLL bit, but you would probably like to know that there are String::FromCString and String::FromBytes methods.


AntonyWells(Posted 2006) [#10]
Didn't know that, thanks.
Check your inbox for a link to you know what.


Dreamora(Posted 2006) [#11]
You can't create .NET Assemblies with BM (using COMs with C# is at best a bad joke and no C# would even consider buying such an library) as GCC can not create them.

libraries for C# need their own design anyway to handle it C# conform (generics, properties and the whole rest of the C# world)


Kuron(Posted 2006) [#12]
You need a special license from BRL to distribute a dll.
It depends on when you bought BMax. If you bought BMax before they came up with that stipulation, you can make a DLL and use it as you wish as license changes cannot be applied retroactively. If you bought BMax after they came up with that stipulation, then you cannot make DLLs without a license.

Why you would make a DLL with BMax is beyond me, there are other languages more suitable to the task.


N(Posted 2006) [#13]
It depends on when you bought BMax. If you bought BMax before they came up with that stipulation, you can make a DLL and use it as you wish as license changes cannot be applied retroactively. If you bought BMax after they came up with that stipulation, then you cannot make DLLs without a license.


Maybe so, but the older versions of BMax are just.... ew. It's like a disfigured, cancerous, rabid dog compared to a cute little bunny rabbit.


Damien Sturdy(Posted 2006) [#14]
I didn't even buy mine, but, when I recieved my first BlitzMax version it wasn't even released, so, Do i have to get a license for DLLs?


AntonyWells(Posted 2006) [#15]
I've had bmax since the first windows beta so I'm set. Take that non retro-active license! Bang straight to the moon!

Dreamora, I'm talking about wrapping a dll and giving it a oo interface in C#.

It's possible in MS .Net with dllImport, but it doesn't work in mono for some reason. Which is all I have at the moment so I can't test until I re-install windows.