Page 2 of 2
Re: Up to date ISAPI include and example (64bit ready)
Posted: Fri Nov 10, 2017 8:39 pm
by swhite
Hi
Do you know if there is a method that is called when the dll is first loaded where I could do some initialization? I would like to load some Chilkat tools and I thought it would be best just to do them once and not on every request. I am assuming that one the dll is loaded it stays in memory.
Thanks,
simon
Re: Up to date ISAPI include and example (64bit ready)
Posted: Fri Nov 10, 2017 8:47 pm
by RichAlgeni
Why yes. Yes there is! Use the normal DLL procedure of 'AttachProcess()' to initialize globally. I use it to open and read html files as well as setup database connections.
I use the ISAPI procedure 'TerminateExtension()' to clean up.
Re: Up to date ISAPI include and example (64bit ready)
Posted: Fri Nov 10, 2017 9:16 pm
by swhite
Hi Rich
I was just about to reply to myself because I discovered the AttachProcess discussion in the PB docs then I read your response. Thanks for confirming my discovery.
I do have a question though. I want to populate a structure with several Chilkat objects so I assume I should declare the structure in the AttachProcess procedure as Global so I can access it from the HttpExtensionProc() procedure.
Simon
Re: Up to date ISAPI include and example (64bit ready)
Posted: Fri Nov 10, 2017 9:19 pm
by RichAlgeni
Anytime!!

Re: Up to date ISAPI include and example (64bit ready)
Posted: Fri Nov 10, 2017 9:22 pm
by swhite
I do have a question though. I want to populate a structure with several Chilkat objects so I assume I should declare the structure in the AttachProcess procedure as Global so I can access it from the HttpExtensionProc() procedure.
Simon
Re: Up to date ISAPI include and example (64bit ready)
Posted: Fri Nov 10, 2017 9:24 pm
by RichAlgeni
Exactly! You can also declare Globals at the beginning of your DLL as well, prior to the procedures.
Re: Up to date ISAPI include and example (64bit ready)
Posted: Sun Nov 12, 2017 2:27 am
by swhite
Hi
I am attempting to use the ChilKat http library in my ISAPI extension but I always get an error on ckHttp::ckCreate() method. I need the Chilkat software because I have to issue an HTTP post command over SSL to get some data that will be returned from the dll. My code works perfectly if I compile everything as a plane console application but once I convert it to a shared dll with the initilization code in the AttachProcess method I get and error on Chilkat ckCreate() method. All the code prior to this works fine. So I am wondering whether it is possible to include their code in my dll.
Thanks,
Simon
Re: Up to date ISAPI include and example (64bit ready)
Posted: Sun Nov 12, 2017 4:07 am
by RichAlgeni
I am not familiar with the specifics around ChilKat, but you can certainly utilize static or dynamic libraries, just as you would in a console application.
Solved: Up to date ISAPI include and example (64bit ready)
Posted: Mon Nov 13, 2017 10:08 pm
by swhite
Hi
I found the problem with Chilkat. They are using modules and the code that initializes the Global variables is not contained in a procedure so for DLLs it never gets executed. So I moved the global declarations into a new procedure called ckInitGlobals() and call this procedure from the AttachProcess() method and everything works just fine.
Re: Up to date ISAPI include and example (64bit ready)
Posted: Mon Nov 13, 2017 11:19 pm
by swhite
Hi
I contacted Chilkat and they are going to change the way they structure their Purebasic modules so they will work with an exe or a shared dll. They said it should be done in several days.
Simon
Re: Up to date ISAPI include and example (64bit ready)
Posted: Mon Nov 13, 2017 11:29 pm
by RichAlgeni