开发者

dll using a file that is within the dll

I'm trying to make a dll that a client app can pass an xml string to and then have an xslt file in the dll be used on the xml string, then return the result back to the client.

How do I get the dll to look for 开发者_高级运维the xslt file within itself? Debugging has shown that the process looks for the xslt file in the folder structure of the test client application I'm using.

I tried making sure the xslt file is identified as an embedded resource of the dll, because I saw to do that in a stack overflow post. Still same problem though.


Assuming C or C++, you'd typically put the XSLT stylesheet text into a string resource via your resource file, then fish it out into memory, and simply pass it as a string into the relevant COM object to perform the XSLT processing.


You could call GetModuleFileName on yourself to get your file name, open yourself, seek to the appropriate byte (takes some arranging e.g. parse PE for resources), load the bytes into RAM, and pass the resulting byte array into the XSLT handler.

There's got to be a better way but this will work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜