Archive: NSIS Unicode 2.42 does not work with new NSIS API lib


NSIS Unicode 2.42 does not work with new NSIS API lib
Hello jimpark,

one of the advantages of NSIS 2.42 is that the /NOUNLOAD is no longer needed for plugins.
But I noticed that this does not seem to work with the Unicode version.

For example the LogEx plugin, which has a normal and a Unicode version.
When the normal NSIS version is used it runs OK, but when the Unicode version is used, only the first command is executed (which was the case with previous NSIS versions).
When I put back the /NOUNLOAD option for every command, the Unicode script runs OK.

Can you have a look at this?

Best regards,
JP


Hey JP,

I'm looking at the source and I noticed only one pluginapi.lib. Unfortunately, we need to have two different ones. One for ANSI and another for Unicode. The stacks are actually different -- one being buffers of wide characters and the other being buffers of chars. So I think the problem is probably due to the fact that it's linking to the wrong lib. For the Unicode one, you'll need to copy the Unicode NSIS 2.42's pluginapi.lib instead.

And yes, this does complicate things for the plugin developers when they want to support both the Unicode NSIS and the ANSI. Put the libs in two different directories and create two different targets for your project, one for ANSI and one for Unicode. Then each of the projects can go out and link to the right lib.


Also, I think I forgot to include the nsis_tchar.h file in the install also. So that will be fixed in 2.42.1.


Hi jimpark,

thanks for looking into this.
Linking the Unicode Plugin with the Unicode pluginapi.lib (renamed it to pluginapiU.lib for convenience) together with your intermediate Unicode NSIS version made it work.

When do you think it will be released?

Best regards,
Jan Pieter


Well, I've asked a few others who had problems with the new release to see if this release fixes all their issues. I've fixed all the issues I know about so far. I've also added a few things to help out with writing scripts that will work for both ANSI and Unicode.

For example, one of the things I've added to the System plugin is System::StrAlloc N which allocates a string buffer for N number of characters rather than just bytes. So System::StrAlloc 1024 will allocate 1024 bytes for ANSI NSIS while it will allocate 2048 bytes for Unicode NSIS. Another thing I've added is a predefined macro NSIS_CHAR_SIZE. This will be 1 for ANSI and 2 for Unicode. So if you are doing math and you want to know how many bytes you need to move forward for the string, you can use ${NSIS_CHAR_SIZE}. And there's of course ${NSIS_UNICODE} which is only defined in the Unicode NSIS. But that's been around for a while.