Page 2 of 2

Re: Unable to load DLL 'tm1api.dll': The specified module could

Posted: Wed Apr 15, 2009 11:44 am
by Mike Cowie
zameelarif wrote:Hi Mike

I have checked my system and the open source dlls are available in the C:\windows\system32 and in TM1 bin folder.The size of these files are different I am attaching a screen shot of the search result. Will it be ok for me to overwrite the files from windows directory to the TM1 bin directory.


Thanks and Regards
Zameel
Hi Zameel,

There's a very good chance the copies in System32 or even Intel\Wireless\Bin are getting picked up first and, because they're older, causing you problems when you try to use the TM1 API. I'd suggest trying to rename the copies in these other two folders (just in case you have to revert back) and then copying in the TM1\bin versions in their place. That should get you past this point (it's worked for me in the past).

One other option you may have (I haven't personally tried this, but the TM1 API manual describes it in a small amount of detail) is to use the Windows API "LoadLibrary" function to specify which DLLs you want to have loaded into memory for your application. I believe you need to load the TM1 API files in a specific order (TM1LIB.DLL, TM1SIP.DLL, TM1API.DLL - they don't list the open souce DLLs, but probably you should load those first) using this function and you need to do that, obviously, before calling any TM1 API functions. When you're all done with your TM1 API calls you should also call the Windows API "FreeLibrary" function for each DLL to let Windows know that you don't need to reference these DLLs anymore.

Between these options you should hopefully be able to get up and running.

Regards,
Mike

Re: Unable to load DLL 'tm1api.dll': The specified module could

Posted: Thu Apr 16, 2009 4:33 am
by zameelarif
Mike,

I was not able to add the tm1 bin to the begining of the path variable and also copying the same version of the dlls also did not solve my issue.
I have found another workaround, i am currently explicitly loading the dlls from the application folder rather than any other folder in the system using the code below

'Declare the function in a seperate module or the tm1api.bas which is already imported.
Public Declare Function SetDllDirectoryA Lib "kernel32" (ByVal lpPathName As String) As Long

'Call this function on the form load
SetDllDirectoryA("c:\cognos\tm1\bin")

This worked and now i can connect and work with TM1

Thanks for all the help and information

Regards
Zameel

Re: Unable to load DLL 'tm1api.dll': The specified module could

Posted: Thu Apr 16, 2009 1:10 pm
by Mike Cowie
Zameel,

Glad to hear you got something working. I haven't used SetDLLDirectory, but it seems like a good approach if all your TM1 API DLLs are in the same place (which they almost always are!).

One thing I wanted to note for other people that I just came across yesterday. The API file set has changed yet again in TM1 9.4; the list of files is now:
  • libeay32.dll
  • ssleay32.dll
  • tm1lib.dll
  • tm1ULibDll.dll
  • tm1api.dll
I assume you still need the ssl subfolder available, too. Anyway, the key changes appear to be the loss of tm1sip.dll and the introduction of tm1ULibDll.dll. I listed these in the order you would need to load them if you're using LoadLibrary/LoadLibraryEx to load them one-by-one.

Regards,
Mike