user711187
user711187

Reputation: 53

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.

Upvotes: 0

Views: 146

Answers (2)

bmargulies
bmargulies

Reputation: 100013

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.

Upvotes: 2

Joshua
Joshua

Reputation: 43197

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.

Upvotes: 0

Related Questions