Help - Search - Members - Calendar
Full Version: Just Made A Dll / .gex File And...
Game Maker Community > Working with Game Maker > Advanced Users Only
JanDeis
It works! I wrote a simple math DLL (actually just one add function) and threw it into an extension. That took me a while to finally figure out but my problem is when I go to run my program (game) it gives me the following error:

CODE
Cannot find used extension package


What is strange is it gives me an error that seemingly says my extension does not work but the function I called out of mt DLL returned the expected value. I passed 2 and 2 into my add function and the DLL received the arguments and returned 4. After that, Game Maker drew the returned value on the screen. I know the DLL works but why is it giving me this error? Here are my source codes:

Create Event of my math object
CODE
sum = vb_add ( 2, 2 );


Draw Event of my math object
I used the DnD draw variable action and drew the variable sum.

.cpp file from my DLL
CODE
#include <windows.h>

extern "C" __declspec(dllexport) double vb_add ( double a, double b );

double vb_add ( double a, double b )
{
    return a + b;
}


One final note, the vb in front of my function does not mean I am using Visual Basic. I always put vb in front of all of my own functions (vb are my initials). I am using Visual Studio 2008 for my C++ coding and GM 7 registered for my game maker coding.
Tahnok
Hmm, sounds like you created a GMK file using the your custom package and then uninstalled the extension or renamed it. That error is usually given when you open a GMK file and it fails to find an extension package that the GMK refers to. Try going into "Extension Packages" in GM7 while your GMK is open and remove your extension package from "Used packages" and re-add it.
JanDeis
I've uninstalled the gex file with my gmk both open and closed and tried reinstalling but I still get error. Would renaming the file still allow it to work though?
JanDeis
Ok, well after trying one more thing, building the .exe for the application, I do not get the error when running the .exe only when I run the program from within GM. I still do not understand why this error comes up, but after talking with a couple other people, I have a theory that it may be the equivalent of a warning in a C++ compiler (it will still build but it just warns the user that there might be unwanted effects in the program).

If anyone has any idea what is going on, I'd still like to know. At least the extension still works wink1.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.