work with DLL

Posted By: Grat

work with DLL - 06/16/19 11:47

Hi,

I not clear, how to use dll.

from
Code
zmq_version	0x1003cd80	0x0003cd80	59 (0x3b)	libzmq.dll	E:\tmp\ZorroBeta\libzmq.dll	Exported Function	


I trying this code ( from sample in manual )
Code
#include <windows.h>

void __stdcall zmq_version(int *,int *,int *);  // line 101
API(zmq_version,libzmq);

void main (void) {
  int v1;
  int v2;
  int v3;
  zmq_version(v1,v2,v3);
  printf("\nversion: %d.%d.%d",v1,v2,v3);
}


but I get error:

hello compiling..
Error in 'line 101:
syntax error
< void __stdcall zmq_version(int *,int *,int *); >.

so, I also try:
Code
void __stdcall zmq_version(int *m,int *n,int *l);  // line 101
void __stdcall zmq_version(int m,int n,int l);      // line 101


for others this a work!!!
Code

void __stdcall zmq_version(int *,int *,int *)
API(zmq_version,libzmq);


I remove the semicolon


but now I get other error:
Code

0mq_zorro compiling....... ok

version: 4.2.0
Error 111: Crash in function
Posted By: Petra

Re: work with DLL - 06/16/19 12:03

Code
#include <windows.h>

void __stdcall zmq_version(int*, int*, int*);  
API(zmq_version,libzmq)

void main (void) {
  int v1;
  int v2;
  int v3;
  zmq_version(&v1,&v2,&v3);
  printf("\nversion: %d.%d.%d",v1,v2,v3);
}
Posted By: Grat

Re: work with DLL - 06/16/19 12:11

Thanks Petra,

I found the problem - the semicolon.

Now I am trying find the error 111

I make on wrapper ZeroMq for Zorro. Maybe missing correct destroy.

Milan
Posted By: Petra

Re: work with DLL - 06/16/19 12:47

Are you sure that __stdcall is right? Thats normally only used for system dlls. For writing an own DLL I would use __cdecl, not __stdcall.
Posted By: Grat

Re: work with DLL - 06/17/19 06:05

Yes,

if I use __cdecl not __stdcall work without problem


Thanks
© 2024 lite-C Forums