Jump to content


Photo

I Can't Create A Dll In Vb.net For Gm


  • Please log in to reply
8 replies to this topic

#1 Mr. Wolf

Mr. Wolf

    GMC Member

  • New Member
  • 34 posts

Posted 27 June 2009 - 09:01 AM

I try to make a dll in VB.net 2008 Express Edition, but I cant load it in GM :GM130: :
I used Extension Maker (as .GEX), I put the Init. box I put the function WM_LoadWiiMotes, but then I get the error:

___________________________________________
Could not locate initialization function WM_LoadWiiMotes
:D

I've tried to add the function in the 'functions' tabled of the Extension Maker, but if I call the function... nothing happens :GM007:

I've also tried it with the GM .net layer, but I get the error:
after calling WM_Class = layer_createinstance(WM_Handle,"Functions",0)
---------------------------
GM .Net Layer: Unhandled Exception
---------------------------
There has been an unhandled exception while finding the required function. Check the names and the argument types. This probably not error created by the "GM .Net Layer". The following trace is available:

System.MissingMethodException: Constructor voor type Functions is niet gevonden.

bij System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)

bij System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)

bij CreateInstance(Double dll_handle, SByte* fullname)

When seeking support, please contact the creater of the program and copy the complete error message. Press Ctrl+C to copy the message. Press Ok to continue or press Cancel to exit the application.
---------------------------
OK Cancel
---------------------------

and after layer_function(WM_Class,"WM_LoadWiiMotes",ty_real,0)
---------------------------
GM .Net Layer: Unhandled Exception
---------------------------
There has been an unhandled exception in the "GM .Net Layer". The following trace is available:

System.NullReferenceException: De objectverwijzing is niet op een exemplaar van een object ingesteld.

bij System.Object.GetType()

bij FuncReal(Double class_handle, SByte* funcname)

When seeking support, please contact the creater of the program and copy the complete error message. Press Ctrl+C to copy the message. Press Ok to continue or press Cancel to exit the application.
---------------------------
OK Cancel
---------------------------
:)

I tried with
dll = 'WiimoteLib.dll';
global.WMConnect = external_define(dll,'GM.WM_LoadWiiMotes',dll_stdcall,ty_string,0);
global.WMDisConnect = external_define(dll,'Functions.WM_DisconnectWiiMotes',dll_stdcall,ty_string,0);

___________________________________________
ERROR in
action number 1
of Create Event
for object Connect:

Error defining an external function.


Some info:
The Sollution name is WiimoteLib
The DLL name is WiimoteLib.dll
The Sollution contains more as 1 Files
I've tried it with a class (called GM) and with a Module (called Functions)
I can make the DLL also in VB.net 2010, C#.net 2008 Express edition, C#.net 2010

:GM130: Can somebody help me??????? :GM071:
:GM071: Thanks in advice! :GM007:
Mr. Wolf

here are the functions:

Sollution name: WiimoteLib
Filename WiimoteLib.dll 
Module name: (WiimoteLib.)Functions
(I've also tried a class, called (WiimoteLib.)GM)
WM_LoadAllWiiMotes() no arguments, nothing returned
WM_CheckButton(WiimoteId (0 to 3), button to check (real)) return: boolean
WM_CheckBattery(WiimoteId (0 to 3) return real
WM_GetAccelX,Y,Z(WiimoteId) return real (3 functions)
WM_Nunchuck_GetAccelX,Y,Z(WiimoteId) return real (3 functions) 
WM_Nunchuck_CheckButton(WiimoteId,Button) return boolean
WM_CheckExtension(WiimoteId) return real
WM_SetLEDs(led 1 boolean, led 2 boolean, led 3 boolean, led 4 boolean)
WM_DisconnectWiiMotes() return nothing
Later I'll make more functions, but for GM is it just Copy and Paste, change a few thing only.

Mr. Wolff


Edited by Mr. Wolf, 27 June 2009 - 04:03 PM.

  • 0

WiiMote Control
use the wii remote in your Game Maker Games

Comming soon: version 2!


no pain, no gain. ehh, game

#2 freaked

freaked

    freak up!

  • New Member
  • 890 posts

Posted 27 June 2009 - 01:34 PM

You CANT use .net modules natively with GM.
The .net layer dll was designed for the purpose of loading such dlls into gm. To help us debug the problem, post the
signature of the function (return type,arguments expected,etc)
  • 0

#3 Mr. Wolf

Mr. Wolf

    GMC Member

  • New Member
  • 34 posts

Posted 28 June 2009 - 09:24 AM

Sollution name: WiimoteLib
Filename WiimoteLib.dll
Module name: (WiimoteLib.)Functions
(I've also tried a class, called (WiimoteLib.)GM)
WM_LoadAllWiiMotes() no arguments, nothing returned
WM_CheckButton(WiimoteId (0 to 3), button to check (real)) return: boolean
WM_CheckBattery(WiimoteId (0 to 3) return real
WM_GetAccelX,Y,Z(WiimoteId) return real (3 functions)
WM_Nunchuck_GetAccelX,Y,Z(WiimoteId) return real (3 functions)
WM_Nunchuck_CheckButton(WiimoteId,Button) return boolean
WM_CheckExtension(WiimoteId) return real
WM_SetLEDs(led 1 boolean, led 2 boolean, led 3 boolean, led 4 boolean)
WM_DisconnectWiiMotes() return nothing
  • 0

WiiMote Control
use the wii remote in your Game Maker Games

Comming soon: version 2!


no pain, no gain. ehh, game

#4 freaked

freaked

    freak up!

  • New Member
  • 890 posts

Posted 28 June 2009 - 03:08 PM

Your functions need to return, and accept as parameters (System.)String or (System.)Double. No other value will do.
The booleans can be converted to and fro from doubles.
  • 0

#5 Mr. Wolf

Mr. Wolf

    GMC Member

  • New Member
  • 34 posts

Posted 28 June 2009 - 03:59 PM

I'll put return in every function and replace Integer trough Double :D
But can you give me the GML??????????????????????????????????? :P

:P Mr. Wolf :P


  • 0

WiiMote Control
use the wii remote in your Game Maker Games

Comming soon: version 2!


no pain, no gain. ehh, game

#6 Mr. Wolf

Mr. Wolf

    GMC Member

  • New Member
  • 34 posts

Posted 28 June 2009 - 04:38 PM

Public Function WM_LoadWiiMotes() As Double
Public Function WM_DisconectWiiMotes() As Double
Public Function WM_GetAccelX(ByVal WiiMoteId As Double) As Double
Public Function WM_GetAccelY(ByVal WiiMoteId As Double) As Double
Public Function WM_GetAccelZ(ByVal WiiMoteId As Double) As Double
Public Function WM_Nunchuck_GetAccelX(ByVal WiiMoteId As Double) As Double
Public Function WM_Nunchuck_GetAccelY(ByVal WiiMoteId As Double) As Double
Public Function WM_Nunchuck_GetAccelZ(ByVal WiiMoteId As Double) As Double
Public Function WM_GetButton(ByVal WiiMoteId As Double, ByVal WiiMoteButton As Double) As Double
Public Function WM_Nunchuck_GetButton(ByVal WiiMoteId As Double, ByVal WiiMoteButton As Double) As Double
Public Function WM_Nunchuck_GetJoystickX(ByVal WiiMoteId As Double, ByVal WiiMoteButton As Double) As Double
Public Function WM_Nunchuck_GetJoystickY(ByVal WiiMoteId As Double, ByVal WiiMoteButton As Double) As Double
Public Function WM_Rumble(ByVal WiiMoteId As Double, ByVal on As Double) As Double
Public Function WM_CheckExtension(ByVal WiiMoteId As Double) As Double
Public Function WM_CheckBattery(ByVal WiiMoteId As Double) As Double
Public Function WM_SetLeds(ByVal WiiMoteId As Double, ByVal Led1 As Double, ByVal Led2 As Double, ByVal Led3 As Double, ByVal Led4 As Double) As Double
Public Function WM_BalanceBoard_GetWeight(ByVal WiiMoteId As Double, ByVal Pos (0 to 4) As Double) As Double
Public Function WM_BalanceBoard_GetCenterOfGravity(ByVal WiiMoteId As Double, ByVal xy (0=x, 1=y) As Double) As Double
This are the functions now!


:P Mr. Wolf :P
  • 0

WiiMote Control
use the wii remote in your Game Maker Games

Comming soon: version 2!


no pain, no gain. ehh, game

#7 freaked

freaked

    freak up!

  • New Member
  • 890 posts

Posted 29 June 2009 - 11:38 AM

First put all those functions in a class called Wii.
Compile it, and rename the dll to gmwii.dll
Now,
layer_init();

testdll = layer_loaddll("gmwii.dll");
global.testclass = layer_createinstance(testdll,"Wii",0);
if (global.testclass = 0)
{
	show_error("FAILED TO LOAD CLASS!",true);
}
layer_function(....)//fill this in

  • 0

#8 Mr. Wolf

Mr. Wolf

    GMC Member

  • New Member
  • 34 posts

Posted 29 June 2009 - 12:12 PM

:P Nice! :P I'm going to try it out now, if it works and I'll put your name in the credits :P

:D Mr. Wolf :P

Edited by Mr. Wolf, 29 June 2009 - 12:36 PM.

  • 0

WiiMote Control
use the wii remote in your Game Maker Games

Comming soon: version 2!


no pain, no gain. ehh, game

#9 Mr. Wolf

Mr. Wolf

    GMC Member

  • New Member
  • 34 posts

Posted 29 June 2009 - 02:45 PM

Here's my WiiMote Control DLL,
My first DLL
:P

:D Mr. Wolf :P
  • 0

WiiMote Control
use the wii remote in your Game Maker Games

Comming soon: version 2!


no pain, no gain. ehh, game