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

  • Home
  • SEARCH
  • 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 7128979
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:11:41+00:00 2026-05-28T11:11:41+00:00

I’m trying to do a little test-plugin using NPAPI for firefox. This is my

  • 0

I’m trying to do a little test-plugin using NPAPI for firefox. This is my code so far:

/*  File: npp_test.cpp
    Copyright (c) 2012 by Niklas Rosenstein

    Testing the NPAPI interface. */

// - Includes & Preprocessors --------------------------------------------------
// - -------- - ------------- --------------------------------------------------

#define DEBUG

#ifdef DEBUG
#   include <iostream>
    using namespace std;
#   include <windows.h>
#endif // DEBUG

#include <stdint.h>

#include <npapi.h>
#include <npfunctions.h>
#include <npruntime.h>

#define DLLEXPORT extern __declspec(dllexport)

// - NPAPI Calls ---------------------------------------------------------------
// - ----- ----- ---------------------------------------------------------------

NPError NP_New(NPMIMEType pluginType, NPP npp, uint16_t mode, int16_t argc,
               char* argn[], char* argv[], NPSavedData* saved);

// - Entrypoints ----------------------
// - ----------- ----------------------

NPError NP_GetEntryPoints(NPPluginFuncs* pFuncs) {
#   ifdef DEBUG
    cout << "NP_GetEntryPoints\n";
#   endif // DEBUG

    // Initialize plugin-functions
    pFuncs->newp = NP_New;

    return NPERR_NO_ERROR;
}

NPError NP_Initialize(NPNetscapeFuncs* npFuncs) {
#   ifdef DEBUG
    cout << "NP_Initialize\n";
    MessageBox(NULL, "NP_Initialize", "Plugin-message", 0);
#   endif // DEBUG
    return NPERR_NO_ERROR;
}

NPError NP_Shutdown() {
#   ifdef DEBUG
    cout << "NP_Shutdown\n";
#   endif // DEBUG
    return NPERR_NO_ERROR;
}

// - Plugin Execution -----------------
// - ------ --------- -----------------

NPError NP_New(NPMIMEType   pluginType,
               NPP          npp,
               uint16_t     mode,
               int16_t      argc,
               char*        argn[],
               char*        argv[],
               NPSavedData* saved) {
#   ifdef DEBUG
    cout << "NP_New\n";
#   endif

    if (!npp)
        return NPERR_INVALID_INSTANCE_ERROR;

    return NPERR_NO_ERROR;
}

I’m compiling the code using g++ 4.4.1

g++ npp_test.cpp -I"D:\include\xulrunner" -shared -Wall -Wextra -o "npp_test.dll"

Compiles fine, but looking at the DLLs content using DLL Expat, the names are not as expected:

==================================================
Function Name     : _get_output_format
Address           : 0x6889c658
Relative Address  : 0x0001c658
Ordinal           : 5 (0x5)
Filename          : npp_test.dll
Type              : Exported Function
Full Path         : C:\Users\niklas\Desktop\npp_test.dll
==================================================

==================================================
Function Name     : _Z6NP_NewPcP4_NPPtsPS_S2_P12_NPSavedData
Address           : 0x68881270
Relative Address  : 0x00001270
Ordinal           : 4 (0x4)
Filename          : npp_test.dll
Type              : Exported Function
Full Path         : C:\Users\niklas\Desktop\npp_test.dll
==================================================

==================================================
Function Name     : NP_GetEntryPoints@4
Address           : 0x688811d8
Relative Address  : 0x000011d8
Ordinal           : 1 (0x1)
Filename          : npp_test.dll
Type              : Exported Function
Full Path         : C:\Users\niklas\Desktop\npp_test.dll
==================================================

==================================================
Function Name     : NP_Initialize@4
Address           : 0x68881205
Relative Address  : 0x00001205
Ordinal           : 2 (0x2)
Filename          : npp_test.dll
Type              : Exported Function
Full Path         : C:\Users\niklas\Desktop\npp_test.dll
==================================================

==================================================
Function Name     : NP_Shutdown@0
Address           : 0x6888124f
Relative Address  : 0x0000124f
Ordinal           : 3 (0x3)
Filename          : npp_test.dll
Type              : Exported Function
Full Path         : C:\Users\niklas\Desktop\npp_test.dll
==================================================

Shouldn’t they be called like in the source? When “expating” the java-dll for firefox, just for example, the names are fine. Using DLLEXPORT as

#define DLLEXPORT __declspec(dllexport)

doesn’t work either. But this at least “removes” the functions _get_output_format and _Z6NP_NewPcP4_NPPtsPS_S2_P12_NPSavedData from being exported, whyever they are exported when not using DLLEXPORT.

Why are the exported functions names with an additional @4/@0 suffix ? I guess the number after the @ specifies the number of bytes the function takes as arguments, but when exporting, this actually shouldn’t be contained in the name, right ?

  • 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-05-28T11:11:41+00:00Added an answer on May 28, 2026 at 11:11 am

    The @(stack_size_of_params) is a name decoration for stdcall extern “C” functions. I’m more familiar with Microsoft tools but my belief is that you will need to use a .def file to export undecorated names for functions that use stdcall.

    Edit: Websearch suggests –kill-at command line option for the GNU tools could avoid need for irksome .def files.

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

Sidebar

Related Questions

I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
We are using XSLT to translate a RIXML file to XML. Our RIXML contains
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I am trying to understand how to use SyndicationItem to display feed which is
Basically, what I'm trying to create is a page of div tags, each has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and

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.