News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Problems with C header file to Asm conversion

Started by nutty, August 11, 2005, 12:50:41 PM

Previous topic - Next topic

nutty

Hi,

Im having some problems converting a c header file into an assembly include file. The source code in C is a sample for a plugin used in a program. Wich includes a library that calls upon these functions below. But i dont know howto convert them into assembly friendly format. If you want i can attach the sample source code.


typedef __declspec(dllexport) void Filter_func(OutputTree *tree);
typedef __declspec(dllexport) bool Validate_func(__int64 id);
typedef __declspec(dllexport) bool Service_func(__int64 id);

__declspec(dllexport) bool SetTreeFilter(Filter_func *func);
__declspec(dllexport) bool RegisterService(const char *serviceName, Service_func *sfunc);
__declspec(dllexport) bool RegisterPopupService(const char *serviceName, Service_func *sfunc, Validate_func *vfunc);


Thanks in advance for any help you can give me!  :U

nutty

Well as it turns out i can bypass the above problem. However, the problem wich i dont know howto solve is the fact that the DLL wich is used to talk to the program using the plugins is written using C++ Classes. So the new question is how can i get C++ Classes wich are exported entries from a DLL to be called from Assembly? The example of such an entry is below:

?RegisterDecoder@@YA_NW4proto_enum@@HP6AHPAVOutputTree@@PAEHH_JGGGG@Z@


Hopefully someone can shed some light on this problem.

PBrennick

nutty,
There is a tool called h2incX, by Japheth (http://www.japheth.de/), that will convert header files into include files.  It is not a perfect world, though, and there will be a need to examine and adjust the resulting file.

hth,
Paul
The GeneSys Project is available from:
The Repository or My crappy website

nutty

Thanks for replying PBrennick! But i have already tried that tool and many others, what happens is that it wont show any of thos exports at all. From what i have read this is because they are made up of a c++ class and i have yet to see any documents on howto "fix" this from assembly. Hope someone does... i would hate to program the plugins in c++ just because of this (i find assembly easier to understand).  :eek

hutch--

Nutty,

Its going to depend on what you want to write for the plugin. What you need to know when writing the plugin is the interface specs that the app will call the plugin with and this means the SIZE of parameters and what they do. If you are going to call te plugin from C++ you will need to prototype the exports from the DLL using EXTERN syntax specified by the compiler you are using and make sure you set the calling convention being used as well.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php