SDK and Borland C++ Builder 2008
YoungRyang
Global Mapper User
Hi, I'm using the SDK and BCB2008 to test the performance of Global Mapper but whenever I try to register the lib and the dll, I get the error "contains invalid OMF record, type 0x21(possibly COFF). I researched the error and a possible cause is that the dll and lib were made in Visual C++ and is incompatible with BCB2008. I was wondering if the dll is incompatible with it or if the problem is just on our end. Thanks
Comments
-
The Global Mapper SDK is created using Visual C++, but as it is just a standard Windows DLL you can call it from pretty much any development environment. The GlobalMapperInterface.dll file is however not an ActiveX control or anything like that needing registered.
In Visual C++ you just include the GlobalMapperInterface.h file in your source and then link to the GlobalMapperInterface.lib file to use it. If BSB2008 can't link against that library file, then you would need to use the Win32 LoadLibrary and GetProcAddress functions to load the DLL at runtime and then get pointers to the functions that you need to call in the SDK.
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com -
Thanks for the reply Mike. I tried to use LoadLibrary to explicitly connect to the dll but everytime I call the LoadLibrary("Location"), I get a NULL as the handle. But if I use LoadLibraryEX with the option DONT_RESOLVE_DLL_REFERENCES, then I am able to get a handle to the dll but I get problems when I try to use the actual procedure that I've extracted. I get a access violation error. Here's part of my very simple code:
typedef uint32(*VFunc)
VFunc _VFunc;
_VFunc=(VFunc)GetProcAddress(handle,"GM_GetSDKVersion");
if(NULL != _VFunc){
uint32 temp = _VFunc(); //This is where my program gets the violation
I think the reason that LoadLibrary is filing is because it is unable to call DllMain and by bypassing it with the DONT_RESOLVE_DLL_REFERENCES option, the dll is unable to load resources that it requires but that's just a guess. I was wondering if I'm doing something wrong in my code or is the way I'm loading the dll. Thanks -
You certainly do NOT want to load the DLL with the flag to not load the DLL references. This basically means you cannot use the DLL (see The Old New Thing : LoadLibraryEx(DONT_RESOLVE_DLL_REFERENCES) is fundamentally flawed for details).
The normal LoadLibrary call should work. If it is not, make sure that the GlobalMapperInterface.dll AND ALL DEPENDENT DLLs are available. You need to copy everything from the SDK's 'bin' folder to wherever your application is looking for the GlobalMapperInterface.dll file, otherwise the DLL won't be able to load because the DLLs that it depends on won't be available.
Once that works, you also need to make sure that your function declarations include the __stdcall calling convention so that the parameters are passed correctly. For example, your declaration should be:
typedef uint32 __stdcall (*VFunc);
Let me know if I can be of further assistance.
Thanks,
Mike
Global Mapper Support
support@globalmapper.com
Categories
- 12.8K All Categories
- 5.7K Features Discussion
- 345 Downloading Imagery
- 1.3K Elevation Data
- 385 Georeferencing Imagery Discussion
- 637 GM Script Language
- 54 User Scripts
- 114 GPS Features
- 417 Projection Questions
- 826 Raster Data
- 1.3K Vector Data
- 6.6K Support
- 178 Announcement and News
- 913 Bug Report
- 558 SDK
- 1.2K Suggestion Box
- 3.7K Technical Support
- 569 Other Discussion
- 131 GIS Data Sources
- 27 Global Mapper Showcase
- 238 How I use Global Mapper
- 107 Global Mapper Forum Website