How to create own BlitzPlus libs?

BlitzPlus Forums/BlitzPlus Beginners Area/How to create own BlitzPlus libs?

va!n(Posted 2006) [#1]
Can someone show and explain me an easy to understand and complete example, how to create own libs for BlitzPlus?

All routines are not coded in Blitz and they are available as *.lib and *.dll files...

So how to create a headerfile or however this is called in BlitzPlus (modul?) to link needed functions to the executeable and how to access the *.dll file? (also two ways are requested).

Btw. here is an test header in C... maybe someone can show me how to modify it and what i need, to get it work with BlitzPlus... thanks.

#ifndef THISLIBNAME
#define THISLIBNAME
extern __declspec(dllimport) long __stdcall Test_Call1(TCHAR * sString1, TCHAR * sString2, long lValue1);
extern __declspec(dllimport) TCHAR * __stdcall Test_Call2(TCHAR * sString1, TCHAR * sString2, TCHAR * sString3, long lValue1, long lValue2);
extern __declspec(dllimport) TCHAR __stdcall Test_Call3(TCHAR * sString1);
extern __declspec(dllimport) float __stdcall Test_Call4(TCHAR * s);
extern __declspec(dllimport) double __stdcall Test_Call5(TCHAR * s);
#endif


b32(Posted 2006) [#2]
My C is a bit rusty I think, but a lib for this should be something like this:
.lib "test.dll"

Test_Call1(s1$, s2$, value)
Test_Call2(s1$, s2$, s3$, v1, v2)
Test_Call3(s$)
Test_Call4(s$)
Test_Call5(s$)

This file should be saved as a ".decls" file, together with the .dll, in the \userlibs directory. (C:\program files\blitzsometing\userlibs)

I'm not sure when exactly, but sometimes you need to add an '@' followed by the size of the parameters in bytes. Ie: "Test_Call1@4"
Integers and floats are 4 bytes, I don't know if there is a fixed size for strings.

Have you seen the docs about .decls ? http://www.blitzbasic.com/sdkspecs/sdkspecs/userlibs_specs.txt


va!n(Posted 2006) [#3]
@b32:
thanks for your posting and many thanks for the link. i didnt know the link before. Are there more SDK links, specifig for B3D, BMax, Bplus ? thx in advance