Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » Using DLI files on Windows
icon5.gif  Using DLI files on Windows [message #38509] Fri, 21 December 2012 06:49 Go to next message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
It is possible that a DLL exports a name (I can see it in dependency walker) but a call to this function crashes, because, I believe, a stub points to a NULL pointer.

Is there a way in Windows to tell that although function's name is exported it cannot be called?

I have a real world example: OpenCL.dll that supports only OpenCL v.1.1 exports function clRetainDevice, which is defined in OpenCL v.1.2. Call to this function crashes, no wonder why.

TIA


Regards,
Novo
Re: Using DLI files on Windows [message #38549 is a reply to message #38509] Sun, 23 December 2012 09:56 Go to previous messageGo to next message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
Well, in that dli struct, functions are represented as member variable pointers, so you can check the existence before making call.

In any case, I do not think that mere NOP instead of missing function is a good idea in most places (say the function is supposed to return a handle that you use downstream in your code, it would cause havoc).

Mirek
Re: Using DLI files on Windows [message #38557 is a reply to message #38549] Sun, 23 December 2012 14:46 Go to previous message
Novo is currently offline  Novo
Messages: 1358
Registered: December 2006
Ultimate Contributor
mirek wrote on Sun, 23 December 2012 03:56

Well, in that dli struct, functions are represented as member variable pointers, so you can check the existence before making call.

In any case, I do not think that mere NOP instead of missing function is a good idea in most places (say the function is supposed to return a handle that you use downstream in your code, it would cause havoc).

Mirek


Thanks. I did check a member for NULL pointer. It looks like this dll is just a proxy to other dlls and I should check version of API instead of a pointer to function because call to clRetainDevice doesn't crash with Intel platform an does crash with NVIDIA although they implement the same version of this API ...

I tried to check content of IMAGE_EXPORT_DIRECTORY.AddressOfFunctions. But everything seemed to be fine.

Sorry for false alarm.


Regards,
Novo
Previous Topic: size_t or int in 64 bits
Next Topic: Repeatable crash
Goto Forum:
  


Current Time: Thu Mar 28 15:36:23 CET 2024

Total time taken to generate the page: 0.01472 seconds