Doug Turner wrote:

Kyle Yuan wrote:

I'm working on an embedding application becasd on mozilla 1.7 using xpcom glue library. But when I tried to use the HTTP POST functionality of LoadURI, I got some trouble:

nsIWebNavigation::LoadURI takes 5 arguments, the last two are nsIInputStream. But if I use NS_NewByteArrayInputStream to create a new nsIInputStream, a link error will occur "error LNK2001: unresolved external symbol "unsigned int __cdecl NS_NewByteArrayInputStream(class nsIByteArrayInputStream * *,char*,unsigned long)"

NS_NewByteArrayInputStream is in xpcom.dll but may be not in xpcomglue.lib.

Did I do something wrong or anyone know how to work around it?

Thanks
Kyle


The idea with |glue| is that it prevents you having to link to xpcom.

I am not sure what you are trying to do, but suppose you have a buffer that you want to set to it. Try something like:

char* postData;
...

nsCOMPtr<nsIStringInputStream> inputStream(do_CreateInstance("@mozilla.org/io/string-input-stream;1", &rv));

if (NS_SUCCEEDED(rv)) {
  rv = inputStream->AdoptData(postData, postDataLength);
...


Regards, Doug Turner


Doh! I do that all of the time... do_CreateInstance isn't part of the SDK yet. :-( Call CreateInstance the way you normally would -- via the component manager (see NS_GetComponentManager).

Doug
_______________________________________________
mozilla-embedding mailing list
[EMAIL PROTECTED]
http://mail.mozilla.org/listinfo/mozilla-embedding

Reply via email to