Jump to content


Photo

Dll Programming Resources


  • Please log in to reply
294 replies to this topic

#221 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 08 June 2008 - 10:30 PM

You have to compile something as a DLL but I don't know if it would work if you rename an EXE. VC++ is so odd to me...
  • 0

#222 cdm319

cdm319

    C++ Programmer

  • New Member
  • 885 posts

Posted 09 June 2008 - 08:46 PM

Of course it wouldn't work if you renamed an EXE...

An EXE is an executable application, run by Windows, generally requiring some sort of direct user interaction.

A DLL is an extension to an EXE.

Revel, in VC++ did you create a Win32 DLL Project?

Edited by cdm319, 09 June 2008 - 08:47 PM.

  • 0

#223 Revel

Revel

    ɹǝqɯǝɯ ɔɯƃ

  • GMC Member
  • 4873 posts
  • Version:GM8

Posted 09 June 2008 - 09:22 PM

No, I was editing an API.

Ive gotten everything sorted out now though, except one thing:

If you create an instance of a class in one function, how can you use the same instance in a new function?

Edited by Revel, 09 June 2008 - 09:23 PM.

  • 0

#224 cdm319

cdm319

    C++ Programmer

  • New Member
  • 885 posts

Posted 10 June 2008 - 02:18 PM

Make the variable scope global, or save the values from that instance into a temporary instance, and then copy those values into the instance in the new function.
  • 0

#225 mimsi

mimsi

    GMC Member

  • New Member
  • 314 posts
  • Version:GM8

Posted 13 June 2008 - 05:52 PM

just a quick question, when you are sending numerical arguments to a DLL's function, what type of variable is it? int, float, double? is it a long int? short int?
  • 0

#226 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 13 June 2008 - 08:20 PM

Game Maker sends it as a Double, it can be changed upon receiving though. Change it to suit your needs.
  • 0

#227 GisleAune

GisleAune

    GMC Member

  • New Member
  • 278 posts

Posted 13 June 2008 - 08:39 PM

Your tuturial works only for C++, can you tell me how to do it in C?

I meant the C/C++ tut.
  • 0

#228 paulman8888

paulman8888

    GMC Member

  • New Member
  • 140 posts

Posted 25 June 2008 - 04:08 PM

So which is the best program for beggingers?
  • 0

#229 biggoron

biggoron

    dura lex sed lex

  • New Member
  • 652 posts

Posted 25 June 2008 - 04:15 PM

Dev-C++ is easier to set up, but Code::Blocks is much better.

Your tuturial works only for C++, can you tell me how to do it in C?

I meant the C/C++ tut.

Probably removing "extern "C"" would do it. Another thing about that C/C++ tutorial, it declares the functions as extern "C" (which I'm almost certain changes the calling convention to cdecl) but it imports with the stdcall convention.
  • 0

#230 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 02 July 2008 - 11:27 PM

I was wondering if Visual Basic C++ 2008 would work to make DLLs compatible with GM. If so, I know it would still follow the same format as a normal C++ but instead of having only 2 sources (CPP,H), it has 5 I think... But yeah, I'm just wondering if it would work because I didn't see VBC++ in the compilers for C++
  • 0

#231 cdm319

cdm319

    C++ Programmer

  • New Member
  • 885 posts

Posted 05 July 2008 - 06:33 PM

Rixeno

Yes, it works, but you need to set it up to compile natively, rather than a .NET configuration. Just select "Win32 DLL" in the project type.
  • 0

#232 Rixeno

Rixeno

    The One 'n' Only

  • New Member
  • 513 posts

Posted 06 July 2008 - 07:53 PM

Thanks, because I'm planning on switching to C++ now but I still wanted to try and make DLLs for Game Maker to widen my horizons :wacko:... It's good to know :)
  • 0

#233 Magicbob

Magicbob

    GMC Member

  • New Member
  • 21 posts

Posted 28 July 2008 - 10:49 PM

<span style='font-size:14pt;line-height:100%'>Compilers > C/C++</span>

1.) Dev-C++
Language: C/C++
Cost: Free
ScreenShots: 1
Information: Bloodshed Dev-C++ is a full-featured Integrated Development Environment (IDE) for the C/C++ programming language. It uses Mingw port of GCC (GNU Compiler Collection) as its compiler. It creates native Win32 executables, either console or GUI. Dev-C++ can also be used in combination with Cygwin.
Link: http://www.bloodshed.net/dev/

2.) Digital Mars C/C++ Compiler Version 8.43
Language: C/C++
Cost: Free
ScreenShots: 1 | 2 | 3
Information: Win32 console versions of the tools, C and C++ compilers, Optlink Linker, Librarian, Standard and Win32 header files. Runtime linkable libraries, Does not come with a debugger, but works with the Symantec or Microsoft debuggers. MicroEmacs for Win32
Link: http://www.digitalma...eecompiler.html

3.) Pelles C
Language: C
Cost: Free
ScreenShots: 1 | 2 | 3 | 4 | 5
Information: Contains an optimizing C compiler, a linker, a resource compiler, a message compiler, a make utility and install builders for both Windows and Pocket PC. It also contains an integrated development environment (IDE) with project management, debugger, source code editor and resource editors for dialogs, menus, string tables, accelerator tables, bitmaps, icons, cursors, animated cursors, animation videos (AVI's without sound), versions and XP manifests. The compiler is based on LCC.
Link:

4.) Borland C++ Compiler
Language: C/C++
Cost: Free
ScreenShots: None
Information: The Borland C++ Compiler 5.5 (BCC) is the foundation and core technology of C++Builder 5. Borland C++ Compiler 5.5 is a blazingly fast 32-bit optimizing compiler. It includes the latest ANSI/ISO C++ language support including, the STL (Standard Template Library) framework and C++ template support and the complete Borland C/C++ Runtime Library (RTL). Also included in the free download are the Borland C/C++ command line tools such as the high performance Borland linker and resource compiler.
Link: http://www.borland.c...d_cbuilder.html

5.) Ultimate++
Language: C++
Cost: Free
ScreenShots: 1 | 2 | 3 | 4 | 5 | 6
Information: Ultimate++ achieves significant reduction of code complexity for most applications when compared to other development platforms.
Ultimate++ based application sources tend to be significantly shorter (often more than 50%) than sources equivalent applications developed using any other C++ platforms (see here and here).
Ultimate++ consists of a set of cross-platform Windows/Linux libraries ("packages"), TheIDE development environment, featuring full featured source editor, Package management system, Visual debugger. BLITZ build technology speeding up GCC builds of large projects up to 4 times, Layout designer for designing dialog layouts Image designer for designing graphical elements of application, Language editor for managing internationalized text strings, and even an icon designer.
The weakness of Ultimate++ is current lack of reference documentation.
Link: http://upp.sourcefor...t/download.html

6.) MinGW
Language: C/C++
Cost: Free
ScreenShots: None
Information: A collection of freely available and freely distributable Windows specific header files and import libraries combined with GNU toolsets that allow one to produce native Windows programs that do not rely on any 3rd-party C runtime DLLs.
Link: http://www.mingw.org/


You should probably mention Code::Blocks and Visual C++ Express Edition. They're both free IDEs.
  • 0

#234 TheMagicNumber

TheMagicNumber

    GMC Member

  • GMC Member
  • 5247 posts
  • Version:Unknown

Posted 29 July 2008 - 01:49 AM

just a quick question, when you are sending numerical arguments to a DLL's function, what type of variable is it? int, float, double? is it a long int? short int?

Game Maker uses doubles for it's numbers. Correct me if wrong please. I don't think it matters...it should work normally when you use any of them.

Edited by GMREC1111, 29 July 2008 - 01:50 AM.

  • 0

#235 Yourself

Yourself

    The Ultimate Pronoun

  • Retired Staff
  • 7341 posts
  • Version:Unknown

Posted 29 July 2008 - 02:07 AM

Game Maker uses doubles for it's numbers. Correct me if wrong please.


That's not wrong.

I don't think it matters...it should work normally when you use any of them.


That is.
  • 0

#236 revolutiongames2004

revolutiongames2004

    GMC Member

  • New Member
  • 54 posts

Posted 14 August 2008 - 05:38 AM

ok when i try to run the C++ tutorial, i get the following when compiling

child 8236(0x258) died before initialization with status code 0x1
*** child state waiting for longjmp
*** child state waiting for longjmp
Resource temporarily unavailable
C:\Dev-Cpp\Projects\Sandbox\Makefile.win [Build Error] [dllmain.o] Error 2

whats am i doings wrong?
  • 0

#237 biggoron

biggoron

    dura lex sed lex

  • New Member
  • 652 posts

Posted 14 August 2008 - 07:45 AM

Code?

And it would be a good idea to stop using Dev-C++, if not now then some time soon.
It's old and bad. The only good thing about it is that it's easy to set up.
  • 0

#238 revolutiongames2004

revolutiongames2004

    GMC Member

  • New Member
  • 54 posts

Posted 14 August 2008 - 01:36 PM

#ifndef _DLL_H_
#define _DLL_H_

#define export extern "C" __declspec (dllexport)

#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_ */

include "dll.h"
#include <windows.h>

export double add(double number1, double number2)
{
	  return(double)number1+number2;
}

  • 0

#239 biggoron

biggoron

    dura lex sed lex

  • New Member
  • 652 posts

Posted 15 August 2008 - 12:23 AM

Well, first of all export is a C++ keyword, it wouldn't be a good idea to use that. If I remember correctly (which I probably don't) you don't need any of that stuff in dll.h or windows.h.

#define GMFN extern "C" __declspec(dllexport)

GMFN double add(double x, double y)
{
	return x + y;
}

Should suffice.

Edited by biggoron, 15 August 2008 - 12:24 AM.

  • 0

#240 revolutiongames2004

revolutiongames2004

    GMC Member

  • New Member
  • 54 posts

Posted 15 August 2008 - 02:57 AM

error:
 dllcrt2.o C:\Dev-Cpp\Projects\Sandbox\ld No such file: No such file or directory. 
 C:\Dev-Cpp\Projects\Sandbox\Makefile.win [Build Error]  [forces.dll] Error 1

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users