Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8996981
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:49:37+00:00 2026-06-15T23:49:37+00:00

I created my own dll that exposes one utility method, namely GenarateID . The

  • 0

I created my own dll that exposes one utility method, namely GenarateID. The header file looks something like this:

#ifndef GENERATE_ID_H
#define GENERATE_ID_H

#include <windows.h>
#include <string>
#include <fstream>
#include <stdio.h>
#include "openssl/sha.h"

int __declspec(dllexport) GenerateID(const char* fileName, char* retVal);

// some additional helper methods declared here, but omitted for brevity
// ...

#endif  // GENERATE_ID_H

What does this method do?
It reads the binary file passed as the first argument, gets some data, generates SHA256 hash of that data, and returns it through the second argument. On success, returned int value is 0, otherwise it’s a negative value. One thing worth mentioning here is that I used OpesSSL library for this purposes.

Now, here is where the problem starts. As the title says, I’m unable to invoke my dll from NSIS using System::Call. (I created simple console test executable, that invokes the library with no problems.)

Here is what I tried, based on this short tutorial:

# copy the files
SetOutPath $INSTDIR
SetOverwrite on
File C:\Users\Strahinja\Desktop\CRX\testfile.zip  # copy the binary
File C:\OpenSSL-Win32\libeay32.dll                # copy OpenSSL library
File C:\Users\Strahinja\Desktop\CRX\IDGenerator\Release\IDGenerator.dll # copy my dll

# generate id
StrCpy $R0 "testfile.zip"
StrCpy $R1 ${NSIS_MAX_STRLEN}   ;assign memory to out parameter ?
StrCpy $R2 -1
#System::Call 'IDGenerator::GenerateID(t, t)i (r10, .r11).r12'
System::Call 'IDGenerator::GenerateID(t r10,t .r11)i.r12'
DetailPrint "File parameter: $R0"
DetailPrint "Generated ID: $R1"
DetailPrint "Return value: $R2"

NSIS says that returned value is error. Is there a way to check what’s the error, and more importantly – am I using this right?

As a side note: I tried using an exe instead of a dll, copying it the same way into the same dir as dll, and calling it with:

nsExec::ExecToStack '"myidgen.exe"'
Pop $R2
Pop $R1

The executable here works fine, but I would still prefer the dll.
I’m sensing that it might have something to do with the calling convention, or the dllexport (since it uses name mangling, AFAIK)
Any suggestions?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:49:38+00:00Added an answer on June 15, 2026 at 11:49 pm

    Error generally means syntax error but it could also mean that LoadLibrary or GetProcAddress failed. Use Dependency Walker to check if the exported function has a decorated name.

    You might want to use a DEF file to export the function.

    If you use EXTERN_C int __cdecl __declspec(dllexport) foo() it should also be exported without decoration but then you need to append ?c to the end of the system call…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got a .dll file created in VC++ 2008 that needs to be widely
I have created several small applications that use my own DLL. The problem is,
I have created my own Attached Property like this: public static class LabelExtension {
So I did a few jobs with ffmpeg and also created my own dll,
I have one WinForms control project that produces a dll. There is a second
I have my own password encryption dll that I am using to check the
I have created a dll containing my own math library. The library allows me
I created my own extension library for Windows Azures Table Storage that supports distributed
I have my own NSIS Plugin DLL I have made. The dll has one
I've trouble with actionListener. I created own simple dialog, which has only two JButtons

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.