Wrapping DLL

BlitzMax Forums/BlitzMax Programming/Wrapping DLL

Jake L.(Posted 2007) [#1]
Hi there,

I got some money left and bought me a Logitech G15 (can't resist the LCD-Display). I got the SDK that unluckily just came with a .lib :( But others wrote a DLL-wrapper (both .NET and oldschool), so I tried to wrap the DLL into Bmax. I managed to compile the stuff, but it failed to work. My C/C++ skills are very bad, so maybe some of you (blessed with C-Knowledge) could have a look at my code and point me to some erros.

First there is a general question:
Could this DLL be wrapped to be used from within BMax? (ignoring the callback stuff - Callbacks are only used for buttons so could be ignored for now)

If the answer to the above is yes, the next question is where did I made an error? It failed on G15_LcdConnect (I get no error but no connection-handle as well).

Ok, here's the deal: if some folks from the C-department could help me out, I will contribute a well documented and easy to use G15-Module with support for ingame-usage as well as output for debugging/profiling purposes.

Here's the original sdk-headerfile:


and here comes my noobish trial to convert this:


Hopefully someone can help me out. Would be really nice (and way cool) to get BMax-support for this.

Thanks
Jake


Dreamora(Posted 2007) [#2]
Naming of the functions is wrong.
As you mention lib I assume you use Visual Studio compiler in which case the naming will get mangled ...

I think it was like _FunctionName@InputBufferSize, but you could use a PE explorer or wordpad to find that one out :)

for example for lgLcdConnectW( ContextW *ctx) this would mean:
_lgLcdConnectW@4


Jake L.(Posted 2007) [#3]
But this won't apply to DLLs, does it? I'd like to use an (existing) wrapper-DLL from this lib. The lib itself isn't compatible to MinGW.

Update: After some websearching I found [a http://sourceforge.net/projects/mylcd/ /] would be very useful. It's fully crossplattform, comes with sources and is able to work together with a whole bunch of LCD-Displays. It should be "relative" easy to create a bmx-module from this...well, if I only knew C++.

Anyone interested?

Jake

PS: I think the plain "draw bitmap to display"-functionality is all bmax-users would want. The other stuff (font rendering etc.) is already existing in bmax.


BORNtobeNAMELESS(Posted 2007) [#4]
This myLCD sounds very interesting.
I'll try to create a Bmax Module if it.


Punksmurf(Posted 2007) [#5]
How are you faring with creating a module?

Just bought the same keyboard and wondered :)


LAB[au](Posted 2007) [#6]
There is lying the last version of it ... I believe

http://btbn.de/ModServer/


Punksmurf(Posted 2007) [#7]
Ah, thanks, but it's linux only so I don't think it'll work trough the windows drivers ;)