1

I would like to be able to use the Google page-speed SDK ( http://code.google.com/p/page-speed/ ) from within managed code ( C# ) I am a bit out of my depth, so if anyone can explain what I need to do that would be great.

I have come across http://www.swig.org which looks like it might be what I need, but there is so much documentation I am finding it difficult to see the wood through the trees!

Cheers,

Chris

Chris
  • 41
  • 6
  • Yes, SWIG is an answer. You can take a look at my sample SWIG project Swig Starter Kit. It hasn't been updated in a while, but it is still relevant. http://code.google.com/p/swigstarterkit/ – lefticus Apr 08 '11 at 04:25

2 Answers2

2

I might have a nice alternative for you :-)

Google page speed has a nice api online. I've wrote a little class to request page speed data and presents it in a neat dataholder class.

Take a look at it here: http://schaffhauser.me/Development.aspx#GooglePageSpeed

I provided the full C# source code and an online demo of it. And its freeware :-)

Chris
  • 21
  • 2
1

The API appears to be C++ class oriented which is not easy to be used from .Net directly.

One approach is to use swig to create a compatible library that you consumed. I've not used swig so I can't really comment on how complicated it is.

I personally would start off simply and create an native DLL that exposes a simple interface that can be used from standard pinvokes.

I would use the example test shell runner as starting point, making this into a DLL with a standard C types, export the symbol via __declspec(dllexport) and use a matching DllImport on the C# side.

http://code.google.com/p/page-speed/source/browse/bin/trunk/src/pagespeed/test_shell_runner.cc

http://msdn.microsoft.com/en-us/library/a90k134d(v=VS.100).aspx

http://msdn.microsoft.com/en-us/library/system.runtime.interopservices.dllimportattribute.aspx

Stephen Gennard
  • 1,910
  • 16
  • 21
  • Thank you for your response, I am off for a long weekend, but when I get back I will go through the links you suggested and see what I can do, thanks again. – Chris Apr 08 '11 at 15:12