Jump to content


Photo

Dll Programming Resources


  • Please log in to reply
295 replies to this topic

#271 Mr. R

Mr. R

    The Great One

  • New Member
  • 1020 posts

Posted 22 March 2009 - 06:31 PM

Sorry for this stupid question... If I have simple functions that only return a result, would it be better to use GML for that or use a language like C/C++ to inline these functions. I'm also looking at how speed would affect it. Calling from DLLs all the time seems like it would be slow but I still think DLLs are made to be built to be abused by application calls but I really don't know.
I'm trying to figure out if I should use simple inline functions in GML and have the functions not possible in GM inside a DLL or put every function in a DLL.
  • 0

#272 score_under

score_under

    Least kawaii

  • GMC Member
  • 1321 posts

Posted 04 April 2009 - 01:27 AM

.NET applications can be decompiled, no matter what they are made in. Not original source, close enough.

Nearly, if not absolutely, everything, can be decompiled with the correct tools and person.

.NET can be decompiled automatically in seconds using freeware, but C++ takes days of manual decompiling by an expert.
  • 0

#273 Revel

Revel

    ɹǝqɯǝɯ ɔɯƃ

  • GMC Member
  • 4922 posts
  • Version:GM8

Posted 05 April 2009 - 04:00 AM

How do you debug a DLL made in C++? Gamemaker keeps displaying "Unexpected error" but I have no idea whats causing the problem.
  • 0

#274 score_under

score_under

    Least kawaii

  • GMC Member
  • 1321 posts

Posted 05 April 2009 - 09:07 PM

How do you debug a DLL made in C++? Gamemaker keeps displaying "Unexpected error" but I have no idea whats causing the problem.

It's very difficult if you don't use Visual Studio (in which case there's probably a tutorial somewhere) but if you're willing to cooperate with me, I could help you debug it...
  • 0

#275 cdm319

cdm319

    C++ Programmer

  • New Member
  • 885 posts

Posted 06 April 2009 - 09:50 PM

.NET applications can be decompiled, no matter what they are made in. Not original source, close enough.

Nearly, if not absolutely, everything, can be decompiled with the correct tools and person.

.NET can be decompiled automatically in seconds using freeware, but C++ takes days of manual decompiling by an expert.


And I repeat myself :whistle:

Nearly, if not absolutely, everything, can be decompiled with the correct tools and person.
  • 0

#276 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts

Posted 17 April 2009 - 09:24 PM

A VERY usefull tool for making dlls!

Regards,
Chris.
  • 0

#277 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 05 June 2009 - 10:58 PM

An important note to Delphi users (preferably the newer versions), Unicode is supported in all strings by default, so for strings you will need to use PAnsiChar instead of PChar as it may not work. Instead of using String, you would use AnsiString, and for Char, you use AnsiChar.

I hope nobody had to learn this the hard way.
  • 0

#278 tangibleLime

tangibleLime

    Lunatic

  • Retired Staff
  • 2520 posts
  • Version:GM:HTML5

Posted 30 June 2009 - 07:46 AM

Compilers and Development Environments [OTHER]

-----------------------------------------------

None
  • 0

#279 tangibleLime

tangibleLime

    Lunatic

  • Retired Staff
  • 2520 posts
  • Version:GM:HTML5

Posted 30 June 2009 - 07:47 AM

Tutorials [OTHER]

-----------------------------------------------

None
  • 0

#280 tangibleLime

tangibleLime

    Lunatic

  • Retired Staff
  • 2520 posts
  • Version:GM:HTML5

Posted 05 July 2009 - 10:29 PM

Tools

-----------------------------------------------

BCX TranslatorProgrammer's Notepad
  • Name: Programmer's Notepad
  • URL: http://www.pnotepad.org/
  • Price ($ USD): Free
  • Language: N/A
  • Other Information: A feature-rich editor directed towards programmers.
  • Submitted By: Unknown

  • 0

#281 tangibleLime

tangibleLime

    Lunatic

  • Retired Staff
  • 2520 posts
  • Version:GM:HTML5

Posted 05 July 2009 - 10:30 PM

Other Resources

-----------------------------------------------

None
  • 0

#282 Revel

Revel

    ɹǝqɯǝɯ ɔɯƃ

  • GMC Member
  • 4922 posts
  • Version:GM8

Posted 13 July 2009 - 07:01 PM

Uhh...Where is the On-Post C++ tutorial? I always came here for a reference when setting up a Dll...
  • 0

#283 staffan15

staffan15

    GMC Member

  • New Member
  • 18 posts

Posted 24 September 2009 - 07:45 PM

Is it possible to create .dll's that works with Game Maker in C#?
  • 0

#284 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 24 September 2009 - 08:07 PM

Yes, but there will be extra work. It's not really nice: You can fiddle with the DLL (or have a program do it for you), or use a wrapper (like GM .NET Layer) to interface it.
  • 0

#285 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts

Posted 04 November 2009 - 10:38 PM

And why exactly my tool wasn't mentioned?
[sarcasm]Oh right, because I made it.[/sarcasm]

Edited by uuf6429, 04 November 2009 - 10:44 PM.

  • 0

#286 gogame1315

gogame1315

    GMC Member

  • New Member
  • 45 posts

Posted 13 December 2009 - 10:02 PM

Dose anyone know how to find all the functions for Pascal (make a message, play a sound...) I know the syntax, but dose pascal have a big help thing like GM that tells you all it can do ?
  • 0

#287 Wins Vega

Wins Vega

    GMC Member

  • New Member
  • 21 posts

Posted 14 December 2009 - 02:45 PM

Is it possible C# DLL's to be defined by Game Maker?
  • 0

#288 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 14 December 2009 - 08:26 PM

Dose anyone know how to find all the functions for Pascal (make a message, play a sound...) I know the syntax, but dose pascal have a big help thing like GM that tells you all it can do ?

You'd need the WinAPI documents, they are the functions you're looking for. As long as you know how to use them, you should be fine.

Is it possible C# DLL's to be defined by Game Maker?

With a wrapper, yes.
  • 0

#289 _165591

_165591

    GMC Member

  • New Member
  • 11 posts

Posted 16 September 2010 - 03:30 PM

i made simple dll in pascal i put in same directory as game and i use

global.define_PAInit = external_define('PetAi.DLL','PAInit',dll_stdcall,ty_real,0);
butit says error defining external function..
thats function:
Function PAInit():real;  stdcall; export;
so what is the problem

Edited by _165591, 16 September 2010 - 03:30 PM.

  • 0

#290 score_under

score_under

    Least kawaii

  • GMC Member
  • 1321 posts

Posted 24 October 2010 - 03:28 PM

@_165591: Just a hunch (and late reply), but try this instead:
global.define_PAInit = external_define('PetAi.DLL', 'PAInit@0'
, dll_stdcall, ty_real, 0);

Tutorials [ASM]

-----------------------------------------------

Assembly Tutorial

I think I PM'd tangibleLime about this a while ago, but this tutorial doesn't work:
1. Pages are missing
2. It talks only about 16-bit ASM, whereas Game Maker is 32-bit.
3. It doesn't mention anything about programming for Windows (vastly different to, for example, real mode programming)
4. It (of course) doesn't talk about DLLs in any way.

Edited by score_under, 24 October 2010 - 03:29 PM.

  • 0

#291 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 25 October 2010 - 08:43 PM

4. It (of course) doesn't talk about DLLs in any way.

It's strange, isn't it. This topic used to actually tell you about making DLLs in the language, now it tells you about the language.
  • 0

#292 Wins Vega

Wins Vega

    GMC Member

  • New Member
  • 21 posts

Posted 01 November 2010 - 07:20 PM

For those who get "Error define external function" in GM
Add the DLL init function:
C++
bool APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved)
{
   return TRUE;
}

  • 0

#293 LSnK

LSnK

    NaN

  • GMC Member
  • 1188 posts

Posted 31 July 2011 - 11:19 PM

Has anyone used get_function_address() yet? I get that it gives you a function pointer, but I have no idea how to actually call into the runner from a DLL. Any tips? A usage example in C++ would be great.

I got a few nasty surprises by calling this function, by the way. Putting it in a debug watch field or as a constant caused my OS to BSOD. I have no idea how that could happen just by reading a number out of a table, but there it is.

Edit: Then again, maybe it was caused by the room being empty. GM 8.1 has some weird bugs.

Edited by LSnK, 01 August 2011 - 06:06 PM.

  • 1

#294 Drara

Drara

    GMC Member

  • GMC Member
  • 313 posts

Posted 06 May 2012 - 12:06 AM

Has anyone used get_function_address() yet? I get that it gives you a function pointer, but I have no idea how to actually call into the runner from a DLL. Any tips? A usage example in C++ would be great.

I got a few nasty surprises by calling this function, by the way. Putting it in a debug watch field or as a constant caused my OS to BSOD. I have no idea how that could happen just by reading a number out of a table, but there it is.

Edit: Then again, maybe it was caused by the room being empty. GM 8.1 has some weird bugs.


Any news on this. Stumbled across this function and people here around say that it is a big step, yet there's none explaining how to use that at all...
A quick hint of it's usage in C# would be also nice...

Very much thanks in advance!

Edited by Drara, 06 May 2012 - 02:09 AM.

  • 0

#295 mnm_manish

mnm_manish

    GMC Member

  • GMC Member
  • 63 posts
  • Version:GM8

Posted 06 January 2013 - 08:06 AM

OK so i tried to make a simple dll to play a sound
here is my code:

#include "SoundDLL.h"
#include <windows.h>
#include <Mmsystem.h>



export bool snd_play(const char* file_path,bool loop)
{
       bool result;
       if (loop==true)
       {
		result=PlaySound(file_path,NULL,SND_FILENAME|SND_LOOP|SND_ASYNC);
       }
       else
       {
       result=PlaySound(file_path,NULL,SND_FILENAME|SND_ASYNC);
       }
       return result;
}
but when i try to compile i get this error
[Linker error] undefined reference to `PlaySoundA@12' 
  [Linker error] undefined reference to `PlaySoundA@12' 
  ld returned 1 exit status 
 C:\Dev-Cpp\Projects\SoundDLL\Makefile.win [Build Error]  [SoundDLL.dll] Error 1
Could some1 please help me :(/>

Your problem looks like it is with a function in the SoundDLL.h file you included. I'm not exactly great with C++, but I think you're gonna need to post the code from SoundDLL.h
<edit>
Or...it might be the fact that you've got #include "SoundDLL.h"
Shouldn't it be #include <SoundDLL.h> ?

Ha ha, i too was victim of that somedays , but i have successfully found a solution.
You need to add library called libwinmm.a in your project.

Edited by Nocturne, 13 January 2013 - 08:18 AM.
SPAM LINK REMOVED

  • 0

#296 BladexDancer

BladexDancer

    GMC Member

  • GMC Member
  • 277 posts
  • Version:GM8

Posted 26 September 2013 - 01:22 PM

.bat for the win!


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users