Up to date ISAPI include and example (64bit ready)

Share your advanced PureBasic knowledge/code with the community.
swhite
Enthusiast
Enthusiast
Posts: 727
Joined: Thu May 21, 2009 6:56 pm

Re: Up to date ISAPI include and example (64bit ready)

Post 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
Simon White
dCipher Computing
User avatar
RichAlgeni
Addict
Addict
Posts: 914
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: Up to date ISAPI include and example (64bit ready)

Post 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.
swhite
Enthusiast
Enthusiast
Posts: 727
Joined: Thu May 21, 2009 6:56 pm

Re: Up to date ISAPI include and example (64bit ready)

Post 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
Last edited by swhite on Fri Nov 10, 2017 9:21 pm, edited 1 time in total.
Simon White
dCipher Computing
User avatar
RichAlgeni
Addict
Addict
Posts: 914
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: Up to date ISAPI include and example (64bit ready)

Post by RichAlgeni »

Anytime!! :D
swhite
Enthusiast
Enthusiast
Posts: 727
Joined: Thu May 21, 2009 6:56 pm

Re: Up to date ISAPI include and example (64bit ready)

Post 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
Simon White
dCipher Computing
User avatar
RichAlgeni
Addict
Addict
Posts: 914
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: Up to date ISAPI include and example (64bit ready)

Post by RichAlgeni »

Exactly! You can also declare Globals at the beginning of your DLL as well, prior to the procedures.
swhite
Enthusiast
Enthusiast
Posts: 727
Joined: Thu May 21, 2009 6:56 pm

Re: Up to date ISAPI include and example (64bit ready)

Post 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
Simon White
dCipher Computing
User avatar
RichAlgeni
Addict
Addict
Posts: 914
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: Up to date ISAPI include and example (64bit ready)

Post 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.
swhite
Enthusiast
Enthusiast
Posts: 727
Joined: Thu May 21, 2009 6:56 pm

Solved: Up to date ISAPI include and example (64bit ready)

Post 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.
Simon White
dCipher Computing
swhite
Enthusiast
Enthusiast
Posts: 727
Joined: Thu May 21, 2009 6:56 pm

Re: Up to date ISAPI include and example (64bit ready)

Post 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
Simon White
dCipher Computing
User avatar
RichAlgeni
Addict
Addict
Posts: 914
Joined: Wed Sep 22, 2010 1:50 am
Location: Bradenton, FL

Re: Up to date ISAPI include and example (64bit ready)

Post by RichAlgeni »

:D
Post Reply