Jump to content


Photo

Dll Programming Resources


  • Please log in to reply
295 replies to this topic

#251 cdm319

cdm319

    C++ Programmer

  • New Member
  • 885 posts

Posted 22 December 2008 - 03:02 PM

C++ is a badly written language but got popular after Microsoft publicized it, now its pretty much the most widely used language.


Do some research before making stupid claims. C++ is a high speed language which became popular as it was based on C, with added capabilities such as object orientated programming.
  • 0

Chris Matthews, Co-Leader of Digital X

#252 IsmAvatar

IsmAvatar

    Good Samaritan

  • GMC Member
  • 2411 posts
  • Version:GM8

Posted 25 December 2008 - 06:32 PM

tdm, I think you got mixed up between C++ and C#. C# is a .NET language. C++ is just an extension of C which is fully compiled using the g++ compiler (or other compilers). C# got popular with MS. C++ is just popular because it added object orientation to C. Granted, I have my own bout to pick with C++, but I wouldn't go so far as to call it a badly written language.
  • 0
Posted Image LateralGM is an IDE for editing GM files on Linux, Mac, and Windows.
We also house the GM File Format Documentation and other projects of that nature.
IsmAvatar.com | Examples | Scripts | Particles | DLLs | Credit Me
Email | Registered

#253 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 27 December 2008 - 03:45 AM

why visual basic dll's not work in game maker?? what's wrong with visual basic??? :)

It is possible, but with restrictions. Only in VB6, slow, and there is problems on newer computers. (Posted from PSP)
  • 0

#254 EXEBEII

EXEBEII

    GMC Member

  • GMC Member
  • 71 posts
  • Version:GM8

Posted 30 December 2008 - 07:40 PM

I was browsing the ASM tutorial and wondered why Turbo asmmembler (TASM) is not listed. It's not an IDE but it is used in the tutorial site provided.
  • 0

[@][@][@][@][@][@][@]******[@][@][@]*********[@][@][@]******[@][@][@][@][@][@][@]******[@][@][@][@][@][@]*********[@][@][@][@][@][@][@]******[@][@][@][@][@][@][@]******[@][@][@][@][@][@][@]
[@][@]************************[@][@]*********[@][@]*********[@][@]*********************[@][@]*********[@][@]******[@][@]***************************[@][@][@]******************[@][@][@]******
[@][@]************************[@][@][@][@][@][@][@]*********[@][@]*********************[@][@]*********[@][@]******[@][@]***************************[@][@][@]******************[@][@][@]******
[@][@][@][@][@]*********************[@][@][@]***************[@][@][@][@][@]************[@][@][@][@][@][@]*********[@][@][@][@]*********************[@][@][@]******************[@][@][@]******
[@][@]************************[@][@][@][@][@][@][@]*********[@][@]*********************[@][@]*********[@][@]******[@][@]***************************[@][@][@]******************[@][@][@]******
[@][@]************************[@][@]*********[@][@]*********[@][@]*********************[@][@]*********[@][@]******[@][@]***************************[@][@][@]******************[@][@][@]******
[@][@][@][@][@][@][@]******[@][@][@]*********[@][@][@]******[@][@][@][@][@][@][@]******[@][@][@][@][@][@]*********[@][@][@][@][@][@][@]******[@][@][@][@][@][@][@]******[@][@][@][@][@][@][@]

#255 cdm319

cdm319

    C++ Programmer

  • New Member
  • 885 posts

Posted 02 January 2009 - 04:13 AM

Probably because it was used in the tutorial site provided, and therefore anyone who read the tutorial would go ahead and download it anyway. That, or maybe he just missed it, or couldn't be bothered at the time.
  • 0

Chris Matthews, Co-Leader of Digital X

#256 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 07 January 2009 - 02:30 AM

This is weird, I tried to add Nvidia PhysX to my project, and I followed the SDK Initialization, but I get this error once I set all the variables to their correct types...
Creating library C:\Documents and Settings\Marc-Andre.YOUR-4DACD0EA75\Desktop\GMPhysX\Debug\GMPhysX.lib and object C:\Documents and Settings\Marc-Andre.YOUR-4DACD0EA75\Desktop\GMPhysX\Debug\GMPhysX.exp
dllmain.obj : error LNK2019: unresolved external symbol _NxCreatePhysicsSDK referenced in function "void __cdecl `dynamic initializer for 'gPhysicsSDK''(void)" (??__EgPhysicsSDK@@YAXXZ)
C:\Documents and Settings\Marc-Andre.YOUR-4DACD0EA75\Desktop\GMPhysX\Debug\GMPhysX.dll : fatal error LNK1120: 1 unresolved externals
I've got this at the beginning
NxPhysicsSDK *gPhysicsSDK = NxCreatePhysicsSDK(NX_PHYSICS_SDK_VERSION, NULL, NULL);
and my function is this
gmexport double GMP_CreateScene(void)
{
	NxSceneDesc sceneDesc;
	sceneDesc.gravity.set(0,-9.8f,0);
	NxScene *gScene = gPhysicsSDK->createScene(sceneDesc);	
	if (!gScene) 
		return -1;
	else
		return 0;
}

  • 0
Do you need an example? You can PM me a request and I'll try my best.
Creations:
- Extra String Functions - Sprite Chroma Key - String at Position - Word Censor - Draw_Line_Width (Unreg GM6-) - Shadowed Text - Draw N-Gon - PIXEL PERFECT COLLISION ENGINE-

#257 biggoron

biggoron

    dura lex sed lex

  • New Member
  • 652 posts

Posted 09 January 2009 - 01:49 AM

Executable code at the module level is not supported in C++, as far as I know. You need to put it in a function. Something like this:

NxPhysicsSDK* gPhysicsSDK = NULL; // NB: Not executable code

void initSDK()
{
	gPhysicsSDK = NxCreatePhysicsSDK(...);   // Executable code
}

...

Edited by biggoron, 09 January 2009 - 01:50 AM.

  • 0

#258 freaked

freaked

    freak up!

  • New Member
  • 890 posts

Posted 09 January 2009 - 09:09 AM

As far as I remember, all Nx* commands are in a separate module. Shouldn't you link Nx*.lib with the dll too ?
  • 0

#259 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 11 January 2009 - 01:34 PM

Yeah, I included the lib already, and I already have the problem solved. I just had to convert the NxReal's to doubles using a small code Dr. Best gave me, so it's problem solved for me... for now :lol:
  • 0
Do you need an example? You can PM me a request and I'll try my best.
Creations:
- Extra String Functions - Sprite Chroma Key - String at Position - Word Censor - Draw_Line_Width (Unreg GM6-) - Shadowed Text - Draw N-Gon - PIXEL PERFECT COLLISION ENGINE-

#260 solano

solano

    GMC Member

  • GMC Member
  • 462 posts
  • Version:GM:Studio

Posted 12 January 2009 - 02:09 PM

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 :(
  • 0

#261 that_dude_over_there>

that_dude_over_there>

    Codezilla

  • New Member
  • 1338 posts

Posted 12 January 2009 - 03:19 PM

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> ?

Edited by that_dude_over_there>, 12 January 2009 - 03:21 PM.

  • 0
I use GM Studio, and am currently a junior year student of Computer Science. In addition to GML, I'm also "fluent" in Java, HTML, CSS, and have a basic understanding of C++ and C.

#262 solano

solano

    GMC Member

  • GMC Member
  • 462 posts
  • Version:GM:Studio

Posted 12 January 2009 - 04:52 PM

well heres the code in my SoundDLL.h
#ifndef _DLL_H_
#define _DLL_H_

/* Begin User-Defined */
#define export extern "C" __declspec (dllexport)
/* End User Defined   */

#if BUILDING_DLL
# define DLLIMPORT __declspec (dllexport)
#else /* Not BUILDING_DLL */
# define DLLIMPORT __declspec (dllimport)
#endif /* Not BUILDING_DLL */


class DLLIMPORT DllClass
{
  public:
	DllClass();
	virtual ~DllClass(void);

  private:

};


#endif /* _DLL_H_ */
and #include "SoundDLL.h" is not the problem.
  • 0

#263 cdm319

cdm319

    C++ Programmer

  • New Member
  • 885 posts

Posted 13 January 2009 - 06:36 PM

It seems to me that the linker is complaining that PlaySound is a function which is declared in a header file which you haven't included.
  • 0

Chris Matthews, Co-Leader of Digital X

#264 freaked

freaked

    freak up!

  • New Member
  • 890 posts

Posted 14 January 2009 - 10:22 AM

You need to link winmm.lib.
And please stop using DevCPP.
Get Visual Studio. The Express editions are free.

Edited by freaked, 14 January 2009 - 10:23 AM.

  • 0

#265 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 14 January 2009 - 01:34 PM

You need to link winmm.lib.
And please stop using DevCPP.
Get Visual Studio. The Express editions are free.

Visual Studio is terrible...Code::Blocks. All free, open source, cross platform.
  • 0

#266 freaked

freaked

    freak up!

  • New Member
  • 890 posts

Posted 16 January 2009 - 10:01 AM

You need to link winmm.lib.
And please stop using DevCPP.
Get Visual Studio. The Express editions are free.

Visual Studio is terrible...Code::Blocks. All free, open source, cross platform.

And why exactly is Visual Studio terrible ?
While I appreciate the fact that Code::Blocks might be free (VS is, too) and open source, but fail to understand why you call it "terrible"
I have used CB in the past I did not find it exactly amazing...
The auto-complete got in the way, the indentation was horrible and it took a lot of time starting up (although so does VS).
Now with VS, the Intellisense works like a charm. Just include a header and presto! All the class defines and functions are there for you to peruse at leisure.
The indentation is better than in CB (I hate K&R).
Large libraries like FLTK hardly take any time in compiling under VS. The debugger and the MSDN express encyclopedia are also nice additions.
Ok, I admit it does take time to install and start-up, and settings are a bit hard to find, but that does NOT make it terrible.
  • 0

#267 cdm319

cdm319

    C++ Programmer

  • New Member
  • 885 posts

Posted 17 January 2009 - 02:55 PM

Visual Studio is a very good IDE, but for things involving native C++ code, it is pointless. The loading time of VS over Dev is ridiculous. VS is a fantastic IDE, as I said, but personally, I only find it useful when coding managed C++ and/or .NET projects. It's simply too... big...! Dev is my preferred compiler because of the fact it's so lightweight.

Personally, I don't like Code::Blocks. It's just an attempt at an open source VS. Which is pointless for me to use, as I have VS :)

There's no reason to be telling people what they should or shouldn't use, that is their own choice, and a basic human right. :)

Edited by cdm319, 17 January 2009 - 02:56 PM.

  • 0

Chris Matthews, Co-Leader of Digital X

#268 cambesa

cambesa

    GMC Member

  • GMC Member
  • 868 posts
  • Version:Unknown

Posted 18 January 2009 - 11:19 PM

what about visual c++ and visual basic?
they are not in the list and i do have/use them and they are free.
  • 0

Insanely large signature removed by a moderator.

(I've had that signature for decades but okay...)


#269 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 18 January 2009 - 11:26 PM

I only find it useful when coding managed C++ and/or .NET projects.

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

Dev-C++ is outdated, update it's compiler :P

Visual C++ is much better for application development, you don't really need visual development for a non-visual executable. Code::Blocks is not an attempt, it's much better then Visual C++ as it's also cross platform ::lmao::

Visual Basic compiles class DLLs which can be used by .NET applications, you can try using the GM Layer DLL to use them in Game Maker.

Edited by GMREC1111, 23 January 2009 - 12:49 AM.

  • 0

#270 cdm319

cdm319

    C++ Programmer

  • New Member
  • 885 posts

Posted 23 January 2009 - 12:13 AM

Being cross-platform doesn't make something better. Code::Blocks does essentially the same as Dev, in that it offers a syntax highlighting, and a short way of compiling your programs.

Dev may be outdated, but then, why would I upgrade it when I only use it for lightweight projects like testing, competition entries and DLLs? It's fantastic if you're running a laptop while not at a power source, as the resource consumption is significantly less.

But each to their own, there is no "right" or "wrong" IDE, it's the user's choice to make.

.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.
  • 0

Chris Matthews, Co-Leader of Digital X

#271 Mr. R

Mr. R

    The Great One

  • Banned Users
  • 1031 posts
  • Version:Unknown

Posted 22 March 2009 - 06:45 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.

Account closed on request.


#272 score_under

score_under

    Least kawaii

  • GMC Member
  • 1321 posts

Posted 04 April 2009 - 01:41 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

Anti-Decompiler for GM6.1 to GM8.1.91! :GM8_new: [Main skin by Sindarin]
Discontinued.

decimal2.png
^ Signature image because it's been sorta empty since the old host died

If you need to contact me, I still get notification emails from PMs.


#273 Revel

Revel

    ɹǝqɯǝɯ ɔɯƃ

  • GMC Member
  • 4935 posts
  • Version:GM8

Posted 05 April 2009 - 04:14 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:21 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

Anti-Decompiler for GM6.1 to GM8.1.91! :GM8_new: [Main skin by Sindarin]
Discontinued.

decimal2.png
^ Signature image because it's been sorta empty since the old host died

If you need to contact me, I still get notification emails from PMs.


#275 cdm319

cdm319

    C++ Programmer

  • New Member
  • 885 posts

Posted 06 April 2009 - 10:04 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

Chris Matthews, Co-Leader of Digital X

#276 uuf6429

uuf6429

    Covac Software

  • New Member
  • 2522 posts

Posted 17 April 2009 - 09:38 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 - 11:12 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

  • GMC Elder
  • 2520 posts
  • Version:GM:HTML5

Posted 30 June 2009 - 08:00 AM

Compilers and Development Environments [OTHER]

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

None
  • 0
Posted ImagePosted Image

#279 tangibleLime

tangibleLime

    Lunatic

  • GMC Elder
  • 2520 posts
  • Version:GM:HTML5

Posted 30 June 2009 - 08:01 AM

Tutorials [OTHER]

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

None
  • 0
Posted ImagePosted Image

#280 tangibleLime

tangibleLime

    Lunatic

  • GMC Elder
  • 2520 posts
  • Version:GM:HTML5

Posted 05 July 2009 - 10:43 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
Posted ImagePosted Image

#281 tangibleLime

tangibleLime

    Lunatic

  • GMC Elder
  • 2520 posts
  • Version:GM:HTML5

Posted 05 July 2009 - 10:44 PM

Other Resources

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

None
  • 0
Posted ImagePosted Image

#282 Revel

Revel

    ɹǝqɯǝɯ ɔɯƃ

  • GMC Member
  • 4935 posts
  • Version:GM8

Posted 13 July 2009 - 07:15 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:59 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:21 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:52 PM

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

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

  • 0

#286 gogame1315

gogame1315

    GMC Member

  • GMC Member
  • 46 posts

Posted 13 December 2009 - 10:16 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:59 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:40 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:44 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:44 PM.

  • 0

#290 score_under

score_under

    Least kawaii

  • GMC Member
  • 1321 posts

Posted 24 October 2010 - 03:42 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:43 PM.

  • 0

Anti-Decompiler for GM6.1 to GM8.1.91! :GM8_new: [Main skin by Sindarin]
Discontinued.

decimal2.png
^ Signature image because it's been sorta empty since the old host died

If you need to contact me, I still get notification emails from PMs.


#291 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 25 October 2010 - 08:57 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:34 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:33 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:20 PM.

  • 1

#294 Drara

Drara

    GMC Member

  • GMC Member
  • 325 posts

Posted 06 May 2012 - 12:20 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:23 AM.

  • 0

#295 mnm_manish

mnm_manish

    GMC Member

  • GMC Member
  • 63 posts
  • Version:GM8

Posted 06 January 2013 - 08:20 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:32 AM.
SPAM LINK REMOVED

  • 0
This is where i belong...

Posted Image

Download Here...
Gautam Buddha was born in Nepal not in India. I don`t know how to put image as link in signature...

#296 BladexDancer

BladexDancer

    GMC Member

  • GMC Member
  • 320 posts
  • Version:GM:Studio

Posted 26 September 2013 - 01:36 PM

.bat for the win!


  • 0

icon170_zps703b58c6.png

#YYG





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users