In followup to a thread Surreal started once (googled it). I am trying to get some basic c functions to work in blitzmax.
- wrote and compiled the code with MingW 3.1 as is said in the thread by Mark Sibly.
- I followed the steps lined out to create the .a file.
- Made the mod directory, the according .bmx file that provides the Extern block. Note: the mod directory is not in the BRL or PUB dir, but straight in the Mods root.
- ran bmk -makemods. it created the needed .i files.
- placed an Import jt.utilities in my game code (name of the mod as I have defined it)
Now my game compiles without giving the nasty 'Could not find Interface to jt.utilities' error, but it fails somewhere in the Linking process saying that the functions I defined in the mod can not be found.
I checked and doublechecked the profile for the functions as they are in the c files and in the .bmx file and they seem to match just fine. Why wouldnt this work?
the c-code
bmx code in module
The module directory structure looks like:
The following files are present there:
The buildlog I get when compiling my game code that references the mod is:
Any ideas? as I am out of em atm..
ps: the Extern block has "Win32" nehind it. I tried it without that but the same error occurs.
- wrote and compiled the code with MingW 3.1 as is said in the thread by Mark Sibly.
- I followed the steps lined out to create the .a file.
- Made the mod directory, the according .bmx file that provides the Extern block. Note: the mod directory is not in the BRL or PUB dir, but straight in the Mods root.
- ran bmk -makemods. it created the needed .i files.
- placed an Import jt.utilities in my game code (name of the mod as I have defined it)
Now my game compiles without giving the nasty 'Could not find Interface to jt.utilities' error, but it fails somewhere in the Linking process saying that the functions I defined in the mod can not be found.
I checked and doublechecked the profile for the functions as they are in the c files and in the .bmx file and they seem to match just fine. Why wouldnt this work?
the c-code
#include <windows.h> static long util_GetTickCount() { return GetTickCount(); } static byte util_QueryPerformanceCounter( long* lpPerformanceCount ) { return QueryPerformanceCounter( (LARGE_INTEGER*) lpPerformanceCount) ? 1 : 0; } static byte util_QueryPerformanceFrequency( long* lpFrequency ) { return QueryPerformanceFrequency( (LARGE_INTEGER*) lpFrequency) ? 1 : 0; }
bmx code in module
Module jt.utilities Strict Import "utilities.a" Extern "Win32" Function util_GetTickCount:Long() Function GetTickCount:Long() = "util_GetTickCount" Function util_QueryPerformanceCounter:Byte( lpPerformanceCount:Long Var ) Function QueryPerformanceCounter:Byte( lpPerformanceCount:Long Var ) = "util_QueryPerformanceCounter" Function util_QueryPerformanceFrequency:Byte( lpFrequency:Long Var ) Function QueryPerformanceFrequency:Byte( lpFrequency:Long Var) = "util_QueryPerformanceFrequency" End Extern
The module directory structure looks like:
<blitzmax>\mod\jt.mod\utilities.mod\
The following files are present there:
- utilities.a - utilities.bmx - utilities.debug.win32.x86.a - utilities.debug.win32.x86.i - utilities.release.win32.x86.a - utilities.release.win32.x86.i
The buildlog I get when compiling my game code that references the mod is:
... Linking:Entry.exe D:/Files/Coding/BlitzMax/SpriteLib/.bmx/Entry.bmx.console.release.win32.x86.o(code+0x35e7): undefined reference to `util_QueryPerformanceFrequency' D:/Files/Coding/BlitzMax/SpriteLib/.bmx/Entry.bmx.console.release.win32.x86.o(code+0x362e): undefined reference to `util_QueryPerformanceCounter' Build Error: Failed to link D:/Files/Coding/BlitzMax/SpriteLib/Entry.exe Process complete
Any ideas? as I am out of em atm..
ps: the Extern block has "Win32" nehind it. I tried it without that but the same error occurs.